Maven wagon error when trying to copy artifact - java

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>

Related

Maven build failing in Flex PMD Report report generation phase

I'm getting the following error while executing the goal com.adobe.ac:flex-pmd-maven-plugin:1.2:report (run-flexpmd-main) in one of the sub modules of our project.
Failed to execute goal com.adobe.ac:flex-pmd-maven-plugin:1.2:report (run-flexpmd-main) on project sample-Project: An error has occurred in Flex PMD Report report generation. A system exception has been thrown: 0 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.adobe.ac:flex-pmd-maven-plugin:1.2:report (run-flexpmd-main) on project sample-Project: An error has occurred in Flex PMD Report report generation.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in Flex PMD Report report generation.
at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.reporting.MavenReportException: A system exception has been thrown
at com.adobe.ac.pmd.maven.AbstractFlexPmdMojo.executeReport(AbstractFlexPmdMojo.java:212)
at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:117)
at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:92)
... 21 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at com.adobe.ac.utils.StackTraceUtils.print(StackTraceUtils.java:48)
at com.adobe.ac.utils.StackTraceUtils.print(StackTraceUtils.java:66)
at com.adobe.ac.pmd.FlexPmdViolations.processFile(FlexPmdViolations.java:202)
at com.adobe.ac.pmd.FlexPmdViolations.processRule(FlexPmdViolations.java:214)
at com.adobe.ac.pmd.FlexPmdViolations.processRule(FlexPmdViolations.java:224)
at com.adobe.ac.pmd.FlexPmdViolations.processRules(FlexPmdViolations.java:244)
at com.adobe.ac.pmd.FlexPmdViolations.computeViolations(FlexPmdViolations.java:103)
at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.computeViolations(AbstractFlexPmdEngine.java:161)
at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.executeReport(AbstractFlexPmdEngine.java:138)
at com.adobe.ac.pmd.maven.AbstractFlexPmdMojo.executeReport(AbstractFlexPmdMojo.java:205)
... 23 more
Below is the goal configuration specified in the pom.xml file:
<plugin>
<groupId>com.adobe.ac</groupId>
<artifactId>flex-pmd-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<failOnError>true</failOnError>
<ruleSet>
${settings.localRepository}/example_dir/flexpmd-rules/${flexPMD_ruleSetVersion}/flexpmd-rules-${flexPMD_ruleSetVersion}.xml
</ruleSet>
</configuration>
<executions>
<execution>
<id>run-flexpmd-main</id>
<phase>process-sources</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<outputDirectory>${project.build.directory}/pmd/main</outputDirectory>
</configuration>
</execution>
<execution>
<id>run-flexpmd-test</id>
<phase>process-test-sources</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
<outputDirectory>${project.build.directory}/pmd/test</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.adobe.flexpmd</groupId>
<artifactId>custom-ruleset</artifactId>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>example_dir</groupId>
<artifactId>flexpmd-rules</artifactId>
<version>${flexPMD_ruleSetVersion}</version>
<type>xml</type>
</dependency>
</dependencies>
</plugin>
We are using the same set of rules for all the other sub projects and there report is getting generated successfully. Only in one particular project it is throwing error.And we haven't made any changes in the flexpmd ruleset recently. This issue started when we migrated our dependencies to a new artifactory and was testing build after migration. I also tried setting failonError as false, but still it is throwing this error. Can anyone please help us to debug this error?

No plugin descriptor found at META-INF/maven/plugin.xml in jooq 3.11.11 trial version

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

How to run tests using sure-fire on a POM package?

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>

Error running a Maven project for Spring MVC due to 'pom.xml' file?

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.

Unable to send email after tests run using Maven Postman plugin

I've been trying all morning but have not had any success sending emails after running my Selenium test suite from the command line using Maven. Here is how we run the suite from the command line.
mvn surefire:test
This is using the Surefire plugin to run a suite of TestNG/Selenium tests. This works great and we want to keep using it. What I need is a way to email the results after each running of the suite. I came across the Postman plugin and it looks perfect. Only problem is I can't get it to work at all. Here is my maven .pom 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mysite.carelogic.selenium</groupId>
<artifactId>automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>carelogic-automation</name>
<description>automation tests for carelogic webapp</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.37.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>20030203.000129</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8-beta4</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.6</version>
<executions>
<execution>
<id>send surefire notification</id>
<phase>deploy</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>false</inherited>
<configuration>
<skip>false</skip>
<from>conner#mysite.com</from>
<subject>Automation Test Results</subject>
<mailhost>relay.mysite.com</mailhost>
<htmlMessageFile>target/surefire-reports/emailable-report.html</htmlMessageFile>
<receivers>
<receiver>conner#mysite.com</receiver>
<receiver>conner#gmail.com</receiver>
</receivers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<showSuccess>true</showSuccess>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
I've confirmed with our techops that our mail server is relay.mysite.com and it is free to use on port 25. No user or password is necessary. When I run the maven command my tests run and I can see what passed and failed but I see no notification that maven tried to send any emails. So I have no idea where to start debugging to see what is wrong. Any help would be greatly appreciated.
*EDIT
Here is the command line output I get when running the above mvn command. As you can see there is no mention of the postman plugin or emails in general.
Results :
Failed tests:
Coleman.shouldBeAbleToVerifyClientCaseLoad:84->BaseSmokeTest.shouldBeAbleToVerifyClientCaseLoad:294 » NoSuchElement
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.727s
[INFO] Finished at: Mon Feb 03 11:44:49 CST 2014
[INFO] Final Memory: 20M/141M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project automation: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Projects\automation\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project automation: There are test failures.
Please refer to C:\Projects\automation\target\surefire-reports for the individual test results.
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: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:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.MojoFailureException: There are test failures.
Please refer to C:\Projects\automation\target\surefire-reports for the individual test results.
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:190)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:852)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:720)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[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/MojoFailureException
Your Maven execution is never reaching the mail sending plugin because there are test failures. Add these lines in maven-surefire-plugin's configuration section :
<testErrorIgnore>true</testErrorIgnore>
<testFailureIgnore>true</testFailureIgnore>
That should solve your problems.
Maybe this can help!
Add the failsafe plugin to you pom.xml
And that would help maven to generate a report even if there are test failures. Then the Postman plugin will come into action.
Also, I am using the below path and tag for email attachments and it works fine for me.
<fileSets>
<fileSet>
<!-- Report directory Path -->
<directory>${project.build.directory}/site/serenity</directory>
<includes>
<!-- Report file name -->
<include>**/serenity-summary.html</include>
</includes>
<!-- Use Regular Expressions like **/*.html if you want all the html files to send-->
</fileSet>
</fileSets>
My failsafe plugin configuration is:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
All in all, what is happening here is that failsafe will allow maven to execute completely even when there are test failures and then fileset seems to be the correct tag to send an attachment.

Categories