Java7
Posts tagged cargo
Maven Cargo Error: Artifact [xx:xx:war] is not a dependency of the project.
Nov 6th
You run a Maven task and it fails with the message “Artifact [xx:xx:war] is not a dependency of the project.”.
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.3:deploy (default-cli) on project hms-web: Artifact [sg.java:hms-web:war] is not a dependency of the project. -> [Help 1]
[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/MojoExecutionException
It tells you to get more help with a link reference that i did not find much helpful.
This error is surfacing because you have specified in your Maven task to deploy the WAR with cargo:deploy.
Cargo could not find the war!
Rectification
Check that your project coordinates tally with what you have specified in the Cargo plugin, specifically the groupId and artifactId.
Making sure the groupId and artifactId project coordinates tally with what is specified in Cargo plugin solves the problem.
Take note of the groupId and artifactId project coordinates specified.
Check that the groupId and artifactId project coordinates tally with what you have specified inside the Cargo plugin.
If the groupId and artifactId project coordinates do not tally, the Cargo plugin will stop with an error.
Mistakes like this are hard to pin point especially if you have transferred this pom.xml from another project which appeared to have worked perfectly. It helps a little if you turn on the DEBUG logging level from the Eclipse preference.
This would have been what you will see with DEBUG logging level:
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.3:deploy (default-cli) on project hms-web: Artifact [sg.java:hms-web:war] is not a dependency of the project. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.3:deploy (default-cli) on project hms-web: Artifact [sg.java:hms-web:war] is not a dependency of the project. 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:60) 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:534) 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: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:354) Caused by: org.apache.maven.plugin.MojoExecutionException: Artifact [sg.java:hms-web:war] is not a dependency of the project. at org.codehaus.cargo.maven2.configuration.AbstractDependency.findArtifactLocation(AbstractDependency.java:182) at org.codehaus.cargo.maven2.configuration.Deployable.computeLocation(Deployable.java:303) at org.codehaus.cargo.maven2.configuration.Deployable.createDeployable(Deployable.java:177) at org.codehaus.cargo.maven2.AbstractDeployerMojo.performDeployerActionOnAllDeployables(AbstractDeployerMojo.java:187) at org.codehaus.cargo.maven2.AbstractDeployerMojo.doExecute(AbstractDeployerMojo.java:103) at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:279) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more
Managing deployment to JBoss Application Server using Maven through Cargo plugin
Mar 19th
Application Server: JBoss Application Server 6.0.0 Final http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.Final/
Sometime ago, i attempted to deploy a JSF 2.0 web application to the newly released GlassFish Application Server 3.1 through the Maven-Cargo plugin. http://java.sg/managing-deployments-to-application-servers-using-maven-through-cargo-plugin/
Cargo is a truly portable plugin that allows you to deploy to most application server vendors and version.
This code snippet shows the same with JBoss Application Server 6.
pom.xml
<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>sg.java</groupId>
<artifactId>web.vms</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Virtualization Management Console</name>
<url>java.sg</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${faces.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${faces.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>${facelets.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primeFaces.version}</version>
</dependency>
<dependency>
<!-- For primefaces theme http://www.primefaces.org/themes.html -->
<groupId>org.primefaces.themes</groupId>
<artifactId>blitzer</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-tools-jboss-deployer-5.1-and-onwards</artifactId>
<version>${cargo.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
<version>5.1.0.GA</version>
</dependency>
</dependencies>
<build>
<finalName>vms</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
<!-- JBoss 6 AS Community -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo.version}</version>
<configuration>
<container>
<containerId>jboss6x</containerId>
<home>${jbossas.home}</home>
</container>
<configuration>
<type>standalone</type>
<home>${jbossas.server}</home>
</configuration>
<deployer>
<type>installed</type>
<deployables>
<deployable>
<groupId>sg.java</groupId>
<artifactId>web.vms</artifactId>
<type>war</type>
<properties>
<context>/vms</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>java.net</id>
<name>java.net</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>prime-repo</id>
<name>Prime Technology Maven Repository</name>
<url>http://repository.prime.com.tr</url>
<layout>default</layout>
</repository>
<!-- http://community.jboss.org/wiki/MavenGettingStarted-Developers -->
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>codehaus-snapshots</id>
<url>http://ci.repository.codehaus.org/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>codehaus snapshot repository</id>
<url>http://snapshots.repository.codehaus.org/</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<properties>
<junit.version>4.8.2</junit.version>
<primeFaces.version>2.2.1</primeFaces.version>
<faces.version>2.0.3</faces.version>
<javaee.version>1.0.0.Final</javaee.version>
<facelets.version>1.1.15.B1</facelets.version>
<cargo.version>1.0.6</cargo.version>
<jbossas.home>C:\c\server\jbossas-vms\jboss-6.0.0.Final</jbossas.home>
<jbossas.server>${jbossas.home}\server\default</jbossas.server>
</properties>
</project>
To deploy, simply issue the following command in the same directory as where your pom.xml descriptor is sitting.
$ mvn cargo:deploy
You should see output similar to this:
bash-3.2$ mvn cargo:redeploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Virtualization Management Console 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- cargo-maven2-plugin:1.0.6:redeploy (default-cli) @ web.vms ---
[INFO] [talledLocalContainer] Parsed JBoss version = [6.0.0]
[INFO] [stalledLocalDeployer] Undeploying [C:\c\server\jbossas-vms\jboss-6.0.0.Final\server\default/deploy/vms.war]...
[INFO] [stalledLocalDeployer] Deploying [C:\c\development projects\project ejb3.1\ide_workspace\ejb3.1_eclipse_workspace\web.vms\target\vms.war] to [C:\c\server\jbossas-vms\jboss-6.0.0.Final\server\default/deploy]...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.929s
[INFO] Finished at: Sat Mar 19 15:29:44 SGT 2011
[INFO] Final Memory: 6M/150M
[INFO] ------------------------------------------------------------------------

