According to guide -https://github.com/WASdev/ci.maven#deploy,
I made pom.xml like below
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<serverHome>D:\eclipses\eGovFrameDev-2.7.0-64bit_Liberty\wlp</serverHome>
<serverName>defaultServer</serverName>
</configuration>
<executions>
<execution>
<id>deploy-app</id>
<phase>post-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<appArchive>D:\eclipses\eGovFrameDev-2.7.0-64bit_Liberty\workspace\Test\target\Test-0.0.1-SNAPSHOT.war</appArchive>
</configuration>
</execution>
</executions>
When I ran 'mvn -X liberty:deploy' I got exception like below
[ERROR] Failed to execute goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:1.0:deploy (default-cli) on project Test: CWWKM2155E: There is no application to be deployed as specified by the appArchive attribute -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:1.0:deploy (default-cli) on project Test: CWWKM2155E: There is no application to be deployed as specified by the appArchive attribute
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(NativeMethodAccessorImpl.java:94)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
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: CWWKM2155E: CWWKM2155E: There is no application to be deployed as specified by the appArchive attribute
at org.codehaus.mojo.pluginsupport.MojoSupport.execute(MojoSupport.java:129)
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.plugin.MojoExecutionException: CWWKM2155E: CWWKM2155E: There is no application to be deployed as specified by the appArchive attribute
at net.wasdev.wlp.maven.plugins.applications.DeployAppMojo.doExecute(DeployAppMojo.java:76)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute(MojoSupport.java:122)
... 21 more
please give me expert advise how to resolve this issue and then deploy application on IBM WAS Liberty with maven
Thanks,
Using Maven command line you can execute a goal (as you are doing in this case) or a lifecycle phase (for example install). In the pom.xml snippet you attached you have a plugin-level configuration (with serverHome and serverName) and execution-level configuration (with appArchive). The issue is when executing a specific goal of a plugin from the command line only the plugin-level configuration is used. That's why the plug-in does not see the appArchive configuration. However, if you were the execute a Maven phase such as install, the execution-level configuration would be used (at the right time) and the application would be deployed.
If you want the deploy goal to work from the command line just move the appArchive configuration to the plugin-level configuration. Also, the following might be helpful: http://maven.apache.org/guides/mini/guide-default-execution-ids.html
Related
I've been evaluating jBPM workbench and KieServer for automatically building and deploying rules, and I'm stuck on what I'm doing wrong. My goal is to have jars built and deployed to KieServer with minimal human intervention, and I've done the following:
Started a Docker container from https://hub.docker.com/r/jboss/jbpm-server-full. I'm able to create and deploy projects from within Workbench - but our workflow will also contain rules built outside of Workbench. If everything looks useful I'll just deploy the Kie Server, but I'm just in the evaluation stage.
Created a simple rules project, with a single Data object and rule (copied directly from a successful deployment using Workbench with modified package name to prevent possible conflict) and with my settings.xml with the correct credentials and the following pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>rules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>kjar</packaging>
<properties>
<kie.version>7.50.0.Final</kie.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<distributionManagement>
<repository>
<id>guvnor-m2-repo</id>
<name>JBPM Workbench Repo</name>
<url>http://localhost:8080/business-central/maven2/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${kie.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${kie.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Built the project using mvn clean package deploy -
The project gets built without error and apparently accepted by the service successfully. I can see the jar in the Docker instance, under /opt/jboss/wildfly/bin/repositories/kie/global/com/example/rules/1.0.0-SNAPSHOT
Tried to create the container using the http://localhost:8080/kie-server/services/rest/server/containers/test PUT API (with correct credentials) but got the following error
{
"type": "FAILURE",
"msg": "Failed to create container test with module com.example:rules:1.0.0-SNAPSHOT: java.lang.RuntimeException: Cannot find KieModule: com.example:rules:1.0.0-SNAPSHOT",
"result": null
}
Tried to create a deployment unit in Workbench. I can see the package in the list and can select it, but the first time I do, I get the following error (it's barely visible in a single line text box - I've formatted it for clarity. This is a selection of a few lines out about 600)
{"ToSubject":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC","CommandType":"getProcessConfig:java.lang.String:","Qualifiers":{"^EncodedType":"java.util.ArrayList","^ObjectID":"1","^Value":[]},"ReplyTo":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC.getProcessConfig:java.lang.String::41:RespondTo:RPC","ErrorTo":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC.getProcessConfig:java.lang.String::41:Errors:RPC","AdditionalDetails":"<tt>
org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error invoking RPC endpoint public abstract org.kie.workbench.common.screens.server.management.model.ProcessConfigModule org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService.getProcessConfig(java.lang.String) throws java.io.IOException
at deployment.business-central.war/org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:75)
at deployment.business-central.war/org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:40)
at deployment.business-central.war/org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
at deployment.business-central.war/org.jboss.errai.cdi.server.CDIExtensionPoints$2.callback(CDIExtensionPoints.java:448)
at deployment.business-central.war/org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47)
at deployment.business-central.war/org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:297)
...
Caused by: java.lang.NullPointerException: <No Message>
at deployment.business-central.war/org.apache.commons.io.IOUtils.toInputStream(IOUtils.java:1647)
at deployment.business-central.war/org.kie.workbench.common.screens.server.management.backend.service.DeploymentDescriptorServiceCDI.getProcessConfig(DeploymentDescriptorServiceCDI.java:56)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.weld.core#3.1.3.Final/org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
at org.jboss.weld.core#3.1.3.Final/org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:106)
at deployment.business-central.war/org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService$1790586371$Proxy$_$$_WeldClientProxy.getProcessConfig(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
On selecting and trying to finish the deployment subsequently, I no longer get the above error but this time get the message GAV 'com.example:rules:1.0.0-SNAPSHOT' not found in the Maven repository. Are you sure you want to deploy it? with the following stack trace in the logs
17:54:30,873 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:pom:1.0.0-SNAPSHOT
17:54:31,177 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:1.0.0-SNAPSHOT
17:54:31,358 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:pom:1.0.0-SNAPSHOT
17:54:31,360 ERROR [org.kie.server.services.impl.KieServerImpl] (default task-16) Error creating container 'baz' for module 'com.example:rules:1.0.0-SNAPSHOT': java.lang.RuntimeException: Cannot find KieModule: com.example:rules:1.0.0-SNAPSHOT
at deployment.kie-server.war//org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:190)
at deployment.kie-server.war//org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:180)
at deployment.kie-server.war//org.kie.server.services.impl.KieServerImpl.createInternalKieContainer(KieServerImpl.java:373)
at deployment.kie-server.war//org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:286)
at deployment.kie-server.war//org.kie.server.remote.rest.common.resource.KieServerRestImpl.createContainer(KieServerRestImpl.java:155)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
So it looks like I've followed all the steps (that I know about) correctly - the jar is built, it's deployed to the /opt/jboss/wildfly/bin/repositories/kie/global/ directory, it's visible in Workbench. But it's not deployable as a container in KieServer. Does anyone have any hints on what I've done wrong?
I found an error in my project. I accidentally copied maven/pom.properties from another project into my META-INF directory, that had a different groupId and artifactId from the jar I was building. This caused the server to deploy the jar into the wrong /opt/jboss/.m2/repository location, so getting GAV 'com.example:rules:1.0.0-SNAPSHOT' not found in the Maven repository. Are you sure you want to deploy it?
After clean checkout/clone from repo, I get this error in eclipse on the execution of the jaxb2-maven-plugin xjc goal.
After "Update Maven Configuration" the code is still not generated.
In my neon3 eclipse(4.6.3) I have installed the m2e plugin(1.7.1) together with the "m2e connector for jaxb2"(4.0.0)
null (org.codehaus.mojo:jaxb2-maven-plugin:2.2:xjc:xjc-evu:generate-sources)
org.apache.maven.plugin.MojoExecutionException
at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution(AbstractJavaGeneratorMojo.java:482)
at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute(AbstractJaxbMojo.java:257)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.NullPointerException
at org.codehaus.mojo.jaxb2.shared.environment.ToolExecutionEnvironment.restore(ToolExecutionEnvironment.java:182)
at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution(AbstractJavaGeneratorMojo.java:427)
... 33 more
In the same pom.xml it is marked under lifecycle-mapping as
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
Here stands that the bitstrings connector should support the jaxb2-maven-plugin and in this comment from the Author I can see there is support since version 1.0.3.201107311209. Nevertheless on the authors homepage it is stated
Plugin: org.codehaus.mojo:jaxb2-maven-plugin Home:
http://mojo.codehaus.org/jaxb2-maven-plugin
(Note: not required for jaxb2-maven-plugin version 1.5+)
Which m2e connector or pom.xml configuration should I use to make jaxb2-maven-plugin work in eclipse (Meaning, it will generate surces in the generate-sources phase on update configuration and add the generated folder into classpath) ?
mvn clean install worked for me.
My workaround: After clean checkout, run the Maven generate-sources phase manually, and configure build-helper plugin to add the jaxb folder as resources folder into eclipse project (for this you need of course the m2e connector for build-helper-maven-plugin )
I am trying to deploy from an exploded war directory, and I get the same context error (happens if I deploy from eclipse or if I try to deploy from the manager page, error output below):
My run configuration - war:exploded tomcat:exploded - copies the contents of the exploded war file to both \apache7\work\Catalina\localhost & \apache7\work\Catalina\localhost\mycontext
Is there an apache\tomcat configuration setting that I'm missing?
Any ideas are greatly appreciated!
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://***:8080/manager/text</url>
<path>/mycontext</path>
<warDirectory>
${project.build.directory}/exploded/${project.build.finalName}.war
</warDirectory>
<server>etomcat</server>
<username>${tomcat.username}</username>
<password>${tomcat.password}</password>
</configuration>
Output from eclipse: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:exploded (default-cli) on project MyProject: Cannot invoke Tomcat manager: FAIL - Failed to deploy application at context path /mycontext
Log:
127.0.0.1 - tomcat [25/Jul/2013:14:05:28 -0400] "GET /manager/text/deploy?path=%2Fmycontext&war=file%3A%2FD%3A%2F[path to project] HTTP/1.1" 200 74
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:exploded (default-cli) on project MyProject: Cannot invoke Tomcat manager: FAIL - Failed to deploy application at context path /mycontext
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:exploded (default-cli) on project Pathways-Core-war: Cannot invoke Tomcat manager: FAIL - Failed to deploy application at context path /mycontext
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
...LifecycleModuleBuilder.buildProject(LifecycleModuleBuildere(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager: FAIL - Failed to deploy application at context path /mycontext
The tomcat maven plugin has been moved to the Apache umbrella and been significantly updated since v1.1. I tried reverting to the mojo you're using, above, and could not get it to deploy either. There's a Tomcat7-specific mojo that works just fine.
Try using
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
...
</configuration>
</plugin>
instead. You can find all the documentation at https://tomcat.apache.org/maven-plugin-2.1/index.html
I have a Maven (3.0.3) / GWT (2.4) project. I'm trying to write some JUnit test cases but running into issues. All my test cases extend GWTTestCase and include this code ...
#Override
public String getModuleName() {
return "com.myco.clearing.product.ProductPlus";
}
The "ProductPlus.gwt.xml" file is located in my src/main/java directory. To include that in my classpath I have this configured for my surefire-plugin ...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.sourceDirectory}</additionalClasspathElement>
<additionalClasspathElement>${project.build.testSourceDirectory}</additionalClasspathElement>
</additionalClasspathElements>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkMode>always</forkMode>
<systemProperties>
<property>
<name>gwt.args</name>
<value>-out \${webAppDirectory}</value>
</property>
</systemProperties>
</configuration>
</plugin>
However, upon running "mvn clean test", I get all these errors, including this one ...
testParsingNodeWithAttributes(com.myco.clearing.commons.xml.XMLNodeTest) Time elapsed: 2.563 sec <<< ERROR!
com.google.gwt.junit.JUnitFatalLaunchException: The test class 'com.myco.clearing.commons.xml.XMLNodeTest' was not found in module 'com.myco.clearing.product.ProductPlus'; no compilation unit for that type was seen
at com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:743)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1346)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:653)
at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:145)
at org.apache.maven.surefire.Surefire.run(Surefire.java:104)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1017)
This is a bizarre error because the class in question is in my src/test/java directory, which I have included as an "additionalClassPathElement" (above). What other configurations do I need to make to correct this error? - Dave
The package for your test must be in the client classpath for the module specified. Based on the module's name, your test probably belongs in the com.myco.clearing.product.client package, or a subpackage of that.
I would like to have the maven eclipse plugin regenerate my .classpath whenever a build is run, and I did so by using the following configuration:
<!--
Generate a new .classpath each time the build is run, but don't try
to download sources or javadocs
-->
<profile>
<id>elipse-update</id>
<activation>
<file>
<exists>.classpath</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>eclipse</goal>
</goals>
<configuration>
<downloadSources>false</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
For some reason, this causes the maven jetty plugin to fail with ClassNotFoundException errors (it complains about all sorts of Spring classes not being there). Of course, it worked without a hit when I didn't have the maven eclipse plugin installed. Here's an example of what I'm talking about:
$ mvn jetty:run
[INFO] Scanning for projects...
...
[INFO] Starting jetty 6.1.22 ...
2010-02-11 20:53:08.984:INFO::jetty-6.1.22
2010-02-11 20:53:09.109:WARN::Could not instantiate listener org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
Of course, if I delete that eclipse plugin section, I can run jetty as expected:
$ mvn jetty:run
[INFO] Scanning for projects...
...
Feb 11, 2010 8:55:28 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 1672 ms
2010-02-11 20:55:28.687:INFO::Started SelectChannelConnector#0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 5 seconds.
Some things I know:
Yes, I only activate this profile if the .classpath is present. This seems counter-intuitive, but I have a reason: I have another profile that activates when the .classpath is absent which runs the eclipse plugin with the options for downloading source code and javadocs set to true. I don't want this to happen each build, so I created a separate plugin config for when the classpath is already there.
Yes, I could simply create properties that held the values of the options I wish to change instead of specifying the entire plugin config again. In that case, I would just set a eclipse.downloadSources property to true or false depending on the presence of the classpath and have a single plugin definition in the regular build section.
Any advice? This is a strange problem.
Thanks,
LES
I suspect the Maven Eclipse Plugin to mess do some classpath woodo that affects the jetty plugin later.
But to be honest, this is not a very common way to use the Eclipse plugin, at least not to my knowledge. Most people don't include it in their build, they just run it when the POM has changed and this generally doesn't happen every build. Moreover, touching the .classpath confuses Eclipse if I remember well and forces a clean rebuild of the project which is pretty annoying.
So at the end, and I'm sorry for that, this seems to introduce more annoyances than benefits. You can try to open a Jira issue though.
You really don't want to run the maven-eclipse-plugin on every build when there's a .classpath present. I can't tell you exactly what it does to the classpaths, but this is not how it's intended to be used. The assumption is that when you run it you only run eclipse:eclipse (or some other goal).
Why do you want to keep re-running it?