Issue
I've got a simple project that is doing nothing for now and which is just a simple Spring Boot 2
application which supposed to use java 9
.
When I run mvnw clean package
over hero-journey
folder I get this error
ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.M5:repackage (default) on project hero-journey-web: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.M5:repackage failed.: RuntimeException ->
[Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.M5:repackage (default) on project hero-journey-web: Execution default of goal org.springframework.boot:spring-boot-maven-plugin
:2.0.0.M5:repackage failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.M5:repackage failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 27 more
Caused by: java.lang.RuntimeException
at org.springframework.asm.ClassVisitor.visitModule(ClassVisitor.java:148)
at org.springframework.asm.ClassReader.readModule(ClassReader.java:762)
at org.springframework.asm.ClassReader.accept(ClassReader.java:663)
at org.springframework.asm.ClassReader.accept(ClassReader.java:527)
at org.springframework.boot.loader.tools.MainClassFinder.createClassDescriptor(MainClassFinder.java:267)
at org.springframework.boot.loader.tools.MainClassFinder.doWithMainClasses(MainClassFinder.java:223)
at org.springframework.boot.loader.tools.MainClassFinder.findSingleMainClass(MainClassFinder.java:203)
at org.springframework.boot.loader.tools.Repackager.findMainMethod(Repackager.java:365)
at org.springframework.boot.loader.tools.Repackager.findMainMethodWithTimeoutWarning(Repackager.java:354)
at org.springframework.boot.loader.tools.Repackager.buildManifest(Repackager.java:325)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:255)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:248)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:193)
at org.springframework.boot.maven.RepackageMojo.repackage(RepackageMojo.java:221)
at org.springframework.boot.maven.RepackageMojo.execute(RepackageMojo.java:208)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 28 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hero-journey-web
It does not provide any particular information about the cause except RuntimeException
and that something happen (it seems) on class parsing.
mvn -version
looks like this
Apache Maven 3.5.0
Maven home: L:\installed\apache-maven-3.5.0\bin\..
Java version: 9, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk-9
What is the problem?
My main pom.xml
looks like this
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lapots.breed.hero.journey</groupId>
<artifactId>hero-journey</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>hero-journey</name>
<description>Start the journey towards the greatest powers</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modules>
<module>hero-journey-web</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>9</java.version>
</properties>
<distributionManagement>
<repository>
<id>google-drive-repository</id>
<url>file://L:/google-drive/m2-artifactory/mvn-releases</url>
</repository>
<snapshotRepository>
<id>google-drive-snapshot</id>
<url>file://L:/google-drive/m2-artifactory/mvn-snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>google-drive-releases</id>
<url>file://L:/google-drive/m2-artifactory/mvn-releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>google-drive-snapshots</id>
<url>file://L:/google-drive/m2-artifactory/mvn-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
My subproject pom.xml
looks like this
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lapots.breed.hero.journey</groupId>
<artifactId>hero-journey</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>hero-journey-web</artifactId>
<description>Hero Journey - web application</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Solution
It seems I ran into existing issue
So I used the solution provided by @wilkinsona to resolve it. I added configuration
with mainClass
and project was successfully built.
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.lapots.breed.hero.journey.web.HeroJourneyWebApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
Answered By - lapots