Getting error: The parameters 'includes' for goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:schemagen are missing or invalid - jaxb2-maven-plugin

Below is how I have included org.codehaus.mojo:jaxb2-maven-plugin:1.5 schemagen plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>schemagen</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>com/abc/domain/**/*.java</include>
</includes>
<outputDirectory>${project.build.directory}/schemas</outputDirectory>
<excludes>
<exclude>**/aspect/*.java</exclude> </excludes>
<verbose>true</verbose>
</configuration>
</plugin>
I am getting this exception:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:schemagen (default-cli) on project domain: The parameters 'includes' for goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:schemagen 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:319)
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:601)
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.PluginParameterException: The parameters 'includes' for goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:schemagen 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

Related

Unable to load the mojo 'execute' in the gmaven-plugin plugin

I upgraded java-8 to java-11 and since then I got an error on gmaven-plugin:
Error injecting constructor, java.lang.ExceptionInInitializerError
at org.codehaus.groovy.maven.plugin.execute.ExecuteMojo.(Unknown Source)
while locating org.codehaus.groovy.maven.plugin.execute.ExecuteMojo
[ERROR] Failed to execute goal org.codehaus.groovy.maven:gmaven-plugin:1.0:execute (tmp-id) on project project-name: Execution tmp-id of goal org.codehaus.groovy.maven:gmaven-plugin:1.0:execute failed: Unable to load the mojo 'execute' in the plugin 'org.codehaus.groovy.maven:gmaven-plugin:1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<id>tmp-id</id>
<phase>install</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
println 'Hello'
</source>
</configuration>
</execution>
</executions>
</plugin>
Any ideas?

Karate: Why NullPointerException at FileUtils happens for mvn clean-integration-test?

Our Karate Scripts for Integration Test works as expected when we use the cmd- mvn integration-test. if we use clean it fails with the below error and the successfully executed test not executing again.
Error log given below when we use the cmd - mvn clean integration-test
[INFO] --- maven-failsafe-plugin:2.13:integration-test (default) # formfill ---
[INFO] Failsafe report directory: D:\Baskaran\wvid-stash\formfill\target\failsafe-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.dnb.vici.formfill.it.FormFill_ITSuite
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.27 sec <<< FAILURE!
initializationError(com.dnb.vici.formfill.it.FormFill_ITSuite) Time elapsed: 0.008 sec <<< ERROR!
java.lang.NullPointerException: null
at com.intuit.karate.FileUtils.resolveIfClassPath(FileUtils.java:157)
at com.intuit.karate.cucumber.KarateFeature.<init>(KarateFeature.java:47)
at com.intuit.karate.cucumber.KarateFeature.loadFeatures(KarateFeature.java:62)
at com.intuit.karate.junit4.Karate.<init>(Karate.java:53)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
Our configuration in POM is given below for reference.
<!-- Following plugin executes the unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version><!--$NO-MVN-MAN-VER$ -->
</plugin>
<!-- Following plugin executes the integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.13</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<includes>
<include>**/FormFill_ITSuite.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
I encountered the same NullPointerException when I compiled my tests with JDK 1.7.0_75. Using 1.8.0_72 instead worked.
You say your tests work before and they stop working when using 'mvn clean'. Unfortunately you don't tell us how you got them working in the first place. But 'mvn clean' removes the existing artifacts and if they are then compiled again with an older JDK, the NullPointerException occurs.

Getting FileNotFoundException when deploying war using Maven Jetty plugin

I'm using Maven 3.0.3 with the Jetty plugin. I'm getting the error below:
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/applicationContext.xml
which I don't understand, because the file is present at target/mywar/WEB-INF/applicationContext.xml. I call this file in my web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4">
<display-name>/jx-production-1.0-SNAPSHOT</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>Any ideas what I'm missing? Here is my Jetty plugin definition in my pom.xml …
<profile>
<id>jetty</id>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.2.2.v20101205</version>
<configuration>
<webAppConfig>
<contextPath>/all-new-jx</contextPath>
<descriptor>target/jx-1.0-SNAPSHOT/WEB-INF/web.xml</descriptor>
</webAppConfig>
<jettyConfig>config/jetty7/jetty.xml</jettyConfig>
<scanIntervalSeconds>10</scanIntervalSeconds>
<contextHandlers>
<contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
<contextPath>/all-new-jx-web</contextPath>
<resourceBase>${project.basedir}/target/web</resourceBase>
<handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
</contextHandler>
</contextHandlers>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
<version>7.2.2.v20101205</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
Here's the long, nasty error I'm getting:
2011-08-04 14:08:56.677:WARN::Failed startup of context
o.m.j.p.JettyWebAppContext{/all-new-jx,file:/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/src/main/webapp/},file:/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/src/main/webapp/
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/applicationContext.xml] at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:641)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:228)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:164)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at org.eclipse.jetty.server.Server.doStart(Server.java:243) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
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:319) 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
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:
java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:641)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:228)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:164)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at org.eclipse.jetty.server.Server.doStart(Server.java:243) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
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:319) 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
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)
Thanks for your advice.
I assume you're using the run goal--i.e. mvn jetty:run? That runs a webapp "in place", meaning it looks for classes in target/classes or in your project dependencies, and it loads web resources from src/main/webapp (assuming default directory layout). It won't find anything in target/mywar/.... You could use one of the other jetty plugin goals, but I'd recommend just moving your applicationContext.xml into the classpath and using classpath:/applicationContext.xml as your contextConfigLocation.

Maven/TestNG reports "Failures: 0" but then "There are test failures.", what's wrong?

I'm using Maven 2.2.1 r801777, Surefire 2.7.1, TestNG 5.14.6, Java 1.6.0_11 on Win XP.
I have only one test class with one empty test method and in my pom I have just added TestNG dependency. When I execute mvn test it prints out:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.301 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
Please refer to [...]\target\surefire-reports for the individual test results.
There is no error in test reports and with -e switch:
[INFO] Trace
org.apache.maven.BuildFailureException: There are test failures.
Please refer to [...]\target\surefire-reports for the individual test results.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
Please refer to [...]\target\surefire-reports for the individual test results.
at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:575)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Any idea?
EDIT
My pom:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample</groupId>
<artifactId>sample</artifactId>
<name>sample</name>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<description />
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.14.6</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
The only class that I have:
import org.testng.Assert;
import org.testng.annotations.Test;
#Test
public class MyTest {
#Test
public void test() {
Assert.assertEquals("a", "a");
}
}
Just created simple example project with your pom file (Fixed some parts) and put it on github ...tested with Maven 2.2.1 and Maven 3.0.2 works perfect. The cause of the problem must be somewhere else...
Please specify the surefire plugin version (2.4.1 if you face the same issue) as follows and also specify the forkmode and useManifestOnlyJar values
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<forkMode>none</forkMode><!-- 'none' is so we can debug -->
<argLine>-enableassertions</argLine>
<!--
<useManifestOnlyJar>false</useManifestOnlyJar>
<useSystemClassLoader>true</useSystemClassLoader>
-->
<suiteXmlFiles>
<suiteXmlFile>
${basedir}/src/main/resources/testng-none.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>

Uploading a File via SCP with Maven fails

I try to upload an ear created by maven to an application server using scp.
When I tried to run
mvn wagon:upload-single
But I get the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload-single (default-cli) on project de.volkswagen.dps.ear: Unable to create a Wagon instance for null: url can not be null -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload-single (default-cli) on project de.volkswagen.dps.ear: Unable to create a Wagon instance for null
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:585)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
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: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: Unable to create a Wagon instance for null
at org.codehaus.mojo.wagon.AbstractWagonMojo.createWagon(AbstractWagonMojo.java:83)
at org.codehaus.mojo.wagon.AbstractSingleWagonMojo.execute(AbstractSingleWagonMojo.java:62)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
... 14 more
Caused by: java.lang.NullPointerException: url can not be null
at org.apache.maven.wagon.repository.Repository.(Repository.java:88)
at org.codehaus.mojo.wagon.shared.WagonUtils.createWagon(WagonUtils.java:51)
at org.codehaus.mojo.wagon.AbstractWagonMojo.createWagon(AbstractWagonMojo.java:79)
... 17 more
I tried to add this to the pom, but it doesn't seem to have any effect:
I added the following to the pom.xml:
...
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<executions>
<execution>
<id>upload-ear</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<fromFile>${project.build.directory}/${project.build.finalName}.ear</fromFile>
<url>scp://servername/</url>
<toDir>.</toDir>
</configuration>
</execution>
</executions>
</plugin>
....
Can anybody explain how I can make this work?
Your current configuration follows the example given in the Usage page and is correct. However, in this example the configuration element is declared inside an execution and thus only applies to this particular execution.
So when you call mvn wagon:upload-single on the command line, the configuration isn't "used" and there is indeed no url parameter configured.
If you want to call the plugin from the command line, either pass the parameters on the command line using -Durl=foo and so on or add a "global" configuration element:
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<configuration>
<fromFile>${project.build.directory}/${project.build.finalName}.ear</fromFile>
<url>scp://servername/</url>
<toDir>.</toDir>
</configuration>
...
</plugin>
...
</plugins>
...
</build>
You can run the following command to run the plugin using the configuration on your pom.xml:
mvn org.codehaus.mojo:wagon-maven-plugin:upload#upload-ear