My type of my project is a POM. I am using maven as my building tool. Currently the project just transfers things around but there is a junit test that I would like to execute. After researching, I came to the realisation that sure-fire doesn't necessarily perform well when the package type is a pom as opposed to a jar. I have fiddled around with the pom and can now run the tests using the following command: mvn clean compiler:testCompile surefire:test but I had to do a major botch fix to my test to make it run using that command. When I run mvn clean install, it doesn't run and I seem to get the following error:
[ERROR] Could not find goal 'surefire:test' in plugin org.apache.maven.plugins:maven-surefire-plugin:2.19.1 among available goals help, test -> [Help 1]
And this is the stacktrace:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.227 s
[INFO] Finished at: 2017-01-31T22:52:39+00:00
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'surefire:test' in plugin org.apache.maven.plugins:maven-surefire-plugin:2.19.1 among available goals help, test -> [Help 1]
org.apache.maven.plugin.MojoNotFoundException: Could not find goal 'surefire:test' in plugin org.apache.maven.plugins:maven-surefire-plugin:2.19.1 among available goals help, test
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:290)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:155)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:131)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:145)
at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:96)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
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:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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)
[ERROR]
[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/MojoNotFoundException
Any suggestions?
Add this goal explicitly:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
And add the maven compiler plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<phase>test-compile</phase>
<goals> <goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
Related
I am trying to generate java class from mssql database using jooq. Currently, I'm using trial version to check the feasibility of code generation and am getting the below error. Pls help.
[ERROR] Failed to parse plugin descriptor for
org.jooq.trial:jooq-codegen-maven:3.11.11
(C:\Users\developer.m2\repository\org\jooq\trial\jooq-codegen-maven\3.11.11\jooq-codegen-maven-3.11.11.jar):
No plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1]
org.apache.maven.plugin.PluginDescriptorParsingException: Failed to
parse plugin descriptor for org.jooq.trial:jooq-codegen-maven:3.11.11
(C:\Users\developer.m2\repository\org\jooq\trial\jooq-codegen-maven\3.11.11\jooq-codegen-maven-3.11.11.jar):
No plugin descriptor found at META-INF/maven/plugin.xml at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.extractPluginDescriptor(DefaultMavenPluginManager.java:241)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:186)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:286)
at
org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:244)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:168)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:154)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:130)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:144)
at
org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:96)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:110)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at
org.apache.maven.cli.MavenCli.execute(MavenCli.java:956) at
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:194) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) 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)
Caused by: java.io.IOException: No plugin descriptor found at
META-INF/maven/plugin.xml at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.extractPluginDescriptor(DefaultMavenPluginManager.java:236)
... 26 more
Pom.xml:
<plugin>
<groupId>org.jooq.trial</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<id>jooq-codegen</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<skip>${skip.jooq.generation}</skip>
</configuration>
</execution>
</executions>
<configuration>
<jdbc>
<driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
<url>${database.url}</url>
<user></user>
<password></password>
</jdbc>
<generator>
<name>org.jooq.codegen.JavaGenerator</name>
<database>
<name>org.jooq.meta.sqlserver.SQLServerDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>dbo</inputSchema>
</database>
<target>
<packageName>org.blackdread.sqltojava.jooq</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
</configuration>
</plugin>
While installing maven into my local repo, it missed out the plugin.xml inside jar. Not sure how though.But I replaced the jar with the actual one and it works. Now I have to check how to install the jar in maven with plugin.xml
I have a multi-module maven java project and I want each module to create a docker container during build phase. I have used the following sample project with microservices as a base project: https://github.com/kbastani/spring-cloud-microservice-example
Plugin configuration is as follows:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
This works ok in the base project and all containers are built correctly. When I updated the groupId and artifactId in the parent and all child modules with my own, then I get the following error during build of child modules
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project users-microservice: Exception caught: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project users-microservice: Exception caught
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
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:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:141)
at com.spotify.docker.BuildMojo.execute(BuildMojo.java:86)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.lang.NullPointerException
at com.spotify.docker.client.DefaultDockerClient.<init>(DefaultDockerClient.java:298)
at com.spotify.docker.client.DefaultDockerClient.<init>(DefaultDockerClient.java:290)
at com.spotify.docker.client.DefaultDockerClient$Builder.build(DefaultDockerClient.java:1840)
at com.spotify.docker.AbstractDockerMojo.buildDockerClient(AbstractDockerMojo.java:169)
at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:138)
If I switch the child modules to consider as parent not my own groupId/artifactId but the ones used in the example, then everything works ok. Am I missing something? Should I upload my parent module somewhere or declare a registry?
Has anybody an idea why I get this erromessage after running the tests of this package? I have already tried to give more memory but it did not suceed. Now I am really desperate to solve this problem. This project contains the client of the application, most tests need to run the GUI (Swing). Can there be any problem when not every thread is able to close the GUI properly?
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38:47.399s
[INFO] Finished at: Mon Jun 22 12:22:11 CEST 2015
[INFO] Final Memory: 58M/171M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project ferps2ClientProd: ExecutionException: java.lang.RuntimeException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Waiting for Jenkins to finish collecting data
[ERROR] Command was /bin/sh -c cd /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd && /usr/lib/jvm/java-7-oracle/jre/bin/java -Xmx1G org.apache.maven.surefire.booter.ForkedBooter /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd/target/surefire/surefire4816148809193217327tmp /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd/target/surefire/surefire_2554625457500993091404tmp
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project ferps2ClientProd: ExecutionException
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:324)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoFailureException: ExecutionException
at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:262)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:252)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:854)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:722)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 30 more
Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:343)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:178)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:990)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:824)
... 33 more
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd && /usr/lib/jvm/java-7-oracle/jre/bin/java -Xmx1G org.apache.maven.surefire.booter.ForkedBooter /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd/target/surefire/surefire4816148809193217327tmp /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd/target/surefire/surefire_2554625457500993091404tmp
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:327)
... 36 more
Caused by: java.lang.RuntimeException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd && /usr/lib/jvm/java-7-oracle/jre/bin/java -Xmx1G org.apache.maven.surefire.booter.ForkedBooter /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd/target/surefire/surefire4816148809193217327tmp /var/lib/jenkins/jobs/ferps2ClientProd/workspace/ferps2ClientProd/target/surefire/surefire_2554625457500993091404tmp
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:515)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:380)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$300(ForkStarter.java:88)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:315)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:306)
... 4 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/MojoFailureException
This is the plugin-section from my pom:
<build>
<finalName>Ferpsclient</finalName>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.12.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<useManifestOnlyJar>false</useManifestOnlyJar>
<useSystemClassLoader>false</useSystemClassLoader>
<reuseForks>false</reuseForks>
<skipTests>${skipTests}</skipTests>
<forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
<forkCount>1C</forkCount>
<argLine>-XX:MaxPermSize=1G</argLine>
<argLine>-Xmx1G</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<encoding>ISO-8859-1</encoding>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!-- mainClass>at.felder.Application</mainClass-->
</manifest>
<manifestEntries>
<Permissions>all-permissions</Permissions>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<!-- includes>
<include>at.felder:ferps2Core:*</include>
<include>at.felder:ferps2API:*</include>
</includes-->
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
You should recraft your argLine tag in the SureFire plugin config to look something like this:
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
Essentially, you need to combine both arguments into one tag and increase the allocation.
I am trying to use the Maven Wagon plugin to copy artifacts to a server.
I have set it up as follows:
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${maven.wagon.version}</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>${maven.wagon.version}</version>
<!-- <dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${maven.wagon.version}</version>
</dependency>
</dependencies> -->
<configuration>
<serverId>appui</serverId>
<fromFile>${project.build.directory}</fromFile>
<includes>${project.build.finalName}.war</includes>
<url>scp://localhost:2221/</url>
<toDir>/opt/jboss/jboss-as-7.1.1.Final/standalone/deployments</toDir>
</configuration>
<executions>
<execution>
<id>upload-war-to-server</id>
<phase>upload</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<serverId>appui</serverId>
<fromFile>${project.build.directory}</fromFile>
<includes>${project.build.finalName}.war</includes>
<url>scp://localhost:2221/opt/jboss/jboss-as-7.1.1.Final/standalone/deployments</url>
</configuration>
</execution>
</executions>
</plugin>
However, when I run this, I get the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (default-cli) on project app.ui: The parameters 'fromFile', 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (default-cli) on project app.ui: The parameters 'fromFile', 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single are missing or invalid
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:221)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'fromFile', 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single are missing or invalid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:576)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 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/PluginParameterException
I have searched github to see how others use Maven Wagon, and I cannot see anything wrong with how I am using it.
Your configuration of the wagon-maven-plugin is incorrect: <fromFile> need to be a reference to a file and not a directory. Also, there is no <includes> tag, as per the documentation.
If you reference the generated Maven artifact (${project.build.finalName}.war), you need to make sure the upload-single goal is executed after package phase (deploy, for example, would be appropriate). In your configuration, you have bound the upload-single goal to phase "upload", which does not exist.
This would be the final configuration :
<plugin>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>${maven.wagon.version}</version>
<executions>
<execution>
<id>upload-war-to-server</id>
<phase>deploy</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<serverId>appui</serverId>
<fromFile>${project.build.directory}/${project.build.finalName}.war</fromFile>
<url>scp://localhost:2221/opt/jboss/jboss-as-7.1.1.Final/standalone/deployments</url>
</configuration>
</execution>
</executions>
</plugin>
I am creating a Maven project for Spring MVC, and I get the following error(s) when I run it. First when I right-click on the project's name, then select 'Run As', and then choose 'Maven build…' (with Goals: jetty:run)
[WARNING] Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext#51671b08{/mvcDemo,C:\Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\webapp}
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:375)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at org.mortbay.jetty.handler.ContextHandler.loadClass(ContextHandler.java:1035)
at org.mortbay.jetty.plugin.Jetty6MavenConfiguration.parseAnnotations(Jetty6MavenConfiguration.java:125)
at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configure(AbstractConfiguration.java:119)
at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configureWebApp(AbstractConfiguration.java:96)
at org.mortbay.jetty.plus.webapp.Configuration.configureWebApp(Configuration.java:124)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1217)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:371)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:307)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:203)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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)
When I try to right-click on the project's name again, select 'Run As', then choose 'Maven clean', and then do 'Maven build...' (with Goals: jetty:run), I receive the error(s) like below:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mvcDemo: Compilation failure: Compilation failure:
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[3,37] error: package org.springframework.stereotype does not exist
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[4,29] error: package org.springframework.ui does not exist
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[5,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[6,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[7,46] error: package org.springframework.web.bind.annotation does not exist
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[9,1] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[10,1] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[19,21] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[37,85] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[51,91] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[18,2] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[37,23] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[36,2] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[51,24] error: cannot find symbol
[ERROR] \Users\7d0\Desktop\Eclipse\WORKSPACE\PROJECTS\mvcDemo\src\main\java\org\mvcDemo\Controllers\MvcControllers.java:[50,2] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoFailureException
I have added the following .jar files in Java Build Path:
jetty-6.1.26.jar,
jetty-plus-6.1.26.jar,
maven-hudson-plugin-6.1.7.jar,
org.mortbay.jetty.util.jar,
plexus-classworlds-2.5.1.jar,
spring-agent-2.5.6.jar,
classmate-1.0.0.jar,
hibernate-validator-5.1.3.Final.jar,
jboss-logging-3.1.3.GA.jar,
validation-api-1.1.0.Final.jar,
commons-logging-1.2.jar,
All .jar files in spring-framework-4.1.4.RELEASE/libs/ folder
(spring-context-4.1.4.RELEASE.jar, spring-web-4.1.4.RELEASE.jar, ...)
Below is my 'pom.xml' file
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>springMvcDemo</groupId>
<artifactId>mvcDemo</artifactId>
<packaging>war</packaging>
<version>1.0.0</version>
<name>mvcDemo Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
</dependency>
</dependencies>
<build>
<finalName>mvcDemo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<argLine>-javaagent C:/Users/7d0/Desktop/Eclipse/Spring MVC Demo/JARs/spring-agent-2.5.6.jar</argLine>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<argLine>-javaagent C:/Users/7d0/Desktop/Eclipse/Spring MVC Demo/JARs/spring-agent-2.5.6.jar</argLine>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
How can I fix the error(s)? Thanks in advance.
You are failing to run because none of the spring dependencies are in your maven build/run classpath.
Adding all the jars to your project build path isn't going to do anything for you when you choose to "run as -> maven project" because maven is going to use the classpath in the pom, ignoring everything you have setup in your IDE.
You should modify the pom file so that it includes the dependencies that you have added to your project build path. You can use the m2e eclipse plugin and import the project as a maven project and it will take care of managing your build classpath using the dependencies specified in your pom file, then you won't have to manage them in two different places.
Some of the classes are not loaded in build path. update your maven project by right click project-->Maven-->Update project--->Force update snapshot and then try it.