Run Maven project from command line with arguments give error - java

I am having a Maven project that has following file structure :
src/main/java/com/TestFolder/{Java file name}
This Java file contains a main method that I need to execute with argument from command line. How this can be done ? Please help.
Currently am doing something like this :
mvn exec:java -Dexec.mainClass=src.main.java.com.TestFolder.MyMainJavaClass -Dexec.args="1"
Is this right syntax to do it ? Because when i run this i get following error :
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven- plugin:1.4.0:java (default-cli) on project Staples_7Lakh: Execution default-cli of goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java failed: Plugin org.codehaus.mojo:exec-maven-plugin:1.4.0 or one of its dependencies could not be resolved: The following artifacts could not be resolved: backport-util-concurrent:backport-util-concurrent:jar:3.1, org.apache.maven:maven-core:jar:2.2.1, org.codehaus.plexus:plexus-utils:jar:3.0.20: Could not transfer artifact backport-util-concurrent:backport-util-concurrent:jar:3.1 from/to central (https://repo.maven.apache.org/maven2): GET request of: backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar from central failed: SSL peer shut down incorrectly -> [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/PluginResolutionException

This problem is because the dependancies are missing in the executable jar. The executable jar needs all run time dependencies to be present. I also had a similar problem which I solved using maven assembly plugin please find below configuration with the pom file for the assembly plugin configuration -
<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>xyz.jeetendra.hibernate.Sample</groupId>
<artifactId>Excercise1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Excercise1</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
<build>
<finalName>UserService</finalName>
<plugins>
<!-- maven Assenmbly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<!--get all project dependency -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- Main class in mainfest make a executable jar -->
<archive>
<manifest>
<mainClass>xyz.jeetendra.hibernate.sample.Service</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
BR

Related

Error when deploying maven project to Google app engine

I was trying to deploy a maven project to Google App Engine, but whenever i use the command mvn appengine:deploy in cmd i get this error
[INFO] GCLOUD:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:43 min
[INFO] Finished at: 2017-04-21T21:43:13+07:00
[INFO] Final Memory: 22M/287M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-
plugin:1.2.1:deploy (default-cli) on project cc_w10: Execution default-cli
of goal com.google.cloud.tools:appengine-maven-plugin:1.2.1:deploy failed:
Non zero exit: 1 -> [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/PluginExecutionException
Here's my 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>org.cc_w10.sample</groupId>
<artifactId>cc_w10</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<INSTANCE_CONNECTION_NAME></INSTANCE_CONNECTION_NAME>
<user>user1</user>
<password>1234</password>
<database>sqldemo</database>
<sqlURL>jdbc:mysql://google/sqldemo?cloudSqlInstance=cc-week-five:us-central1:root&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=root&password=1234&useSSL=false</sqlURL>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-6</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.5</version>
</dependency>
</dependencies>
<build>
<finalName>cc_w10</finalName>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.2.1</version>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.50</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Does anyone know how to solve this problem? I've been looking for the solution for days but it seems hopeless.
your project is a spring boot project so try using spring-maven plugin to generate the jar
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
I had the same problem, and tried it a different way.
Since appengine:deploy didn't seem to copy my app.yaml but instead created its own, I tried to use gcloud commands directly on the target/appengine-staging after pasting my yaml file.
Then I run gcloud app deploy and it worked thanks to this line I added in app.yaml:
health_check: enable_health_check: False
Starting from version 1.3.0 the appengine plugin even doesn't detect my app.yaml in the first place. However it's set on the root folder. I suppose it requires it in a different place/folder but I don't know which one.
Pretty late to the party, but make sure you have specified the packaging as 'war'. That solved my issue.

'dependencies.dependency.version' for com.google.appengine:appengine-api-1.0-sdk:jar must be a valid version but is '${appengine.target.version}'

I created a project using the maven 3.3.9 using the command mvn archetype:generate then search the endpoint archtype and select that then i insert the groupid artifectId version ...etc after that i import this project in Eclipse Neon and As i am running this project appengine:devserver command i am getting error message given below :
Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] -> [Help 2]
[ERROR] Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] -> [Help 2]
[ERROR] 'dependencies.dependency.version' for com.google.appengine:appengine-api-1.0-sdk:jar must be a valid version but is '${appengine.target.version}'. # line 34, column 13
[ERROR] 'dependencies.dependency.version' for com.google.appengine:appengine-endpoints:jar must be a valid version but is '${appengine.target.version}'. # line 39, column 13
[ERROR] 'dependencies.dependency.version' for com.google.appengine:appengine-testing:jar must be a valid version but is '${appengine.sdk.version}'. # line 69, column 13
[ERROR] 'dependencies.dependency.version' for com.google.appengine:appengine-api-stubs:jar must be a valid version but is '${appengine.sdk.version}'. # line 75, column 13
[ERROR] 'build.plugins.plugin.version' for com.google.appengine:appengine-maven-plugin must be a valid version but is '${appengine.sdk.version}'. # line 122, column 14
[ERROR] 'build.plugins.plugin.version' for com.google.appengine:gcloud-maven-plugin must be a valid version but is '${gcloud.plugin.version}'. # line 145, column 14
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/InterpolationCycleException
And generated POM.xml File is given below. I dont have any idea why i am getting this error and how to resolve it. From the initial Error reading i got the information something is wrong with the {{gcloud.plugin.version}} but what is the problem and how can i resolve this issue.
<?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>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.demo.app</groupId>
<artifactId>demo-app</artifactId>
<properties>
<app.id>your-app-id</app.id>
<app.version>1</app.version>
<appengine.version>${appengine.sdk.version}</appengine.version>
<gcloud.plugin.version>${gcloud.plugin.version}</gcloud.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<archiveClasses>true</archiveClasses>
</properties>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.target.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-endpoints</artifactId>
<version>${appengine.target.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
<!-- the list has a default value of ** -->
<includes>
<include>WEB-INF/*.discovery</include>
<include>WEB-INF/*.api</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
<version>${app.version}</version>
<!-- Comment in the below snippet to bind to all IPs instead of just
localhost -->
<!-- address>0.0.0.0</address> <port>8080</port -->
<!-- Comment in the below snippet to enable local debugging with a remote
debugger like those included with Eclipse or IntelliJ -->
<!-- jvmFlags> <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n</jvmFlag>
</jvmFlags -->
</configuration>
<executions>
<execution>
<goals>
<goal>endpoints_get_discovery_doc</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>${gcloud.plugin.version}</version>
<configuration>
<set_default>true</set_default>
</configuration>
</plugin>
</plugins>
</build>
Define the appengine.target.version and gcloud.plugin.version property in <properties>. You can google the latest version of appengine-sdk and gcloud.plugin.version using https://cloud.google.com/sdk/downloads
<appengine.version>1.9.42</appengine.version>
<gcloud.plugin.version>124</gcloud.plugin.version>

Error building java desktop application from eclipse

I am trying to build a github project pdfSAM on eclipse. The dependencies are JAVA 8, getText and Maven. I installed all the plugins on eclipse but when I build the project using pom.xml I am getting an error for pdfsam-core project-
"Failed to execute goal on project pdfsam-core: Could not resolve dependencies for project org.pdfsam:pdfsam-core:jar:3.0.0.RELEASE-SNAPSHOT: The following artifacts could not be resolved: org.sejda:sejda-model:jar:2.0.0-alpha13, org.sejda:sejda-conversion:jar:2.0.0-alpha13: Failure to find org.sejda:sejda-model:jar:2.0.0-alpha13 in https://repository.jboss.org/nexus/content/repositories/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced -> [Help 1] "
Build error on eclipse
I also tried building the project from command line using commands
1.mvn clean install
2.mvn clean install -PfastTests
3.mvn clean install -Dmaven.test.skip=true
All the commands give me me same error and a Build failure occurs.
I am also inserting the pom.xml file of pdfsam-core-
<?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>
<description>Core pdfsam library</description>
<parent>
<groupId>org.pdfsam</groupId>
<artifactId>pdfsam-parent</artifactId>
<version>3.0.0.RELEASE-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.pdfsam</groupId>
<artifactId>pdfsam-i18n</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx</artifactId>
</dependency>
<dependency>
<groupId>org.sejda</groupId>
<artifactId>sejda-model</artifactId>
</dependency>
<dependency>
<groupId>org.sejda</groupId>
<artifactId>sejda-conversion</artifactId>
</dependency>
<dependency>
<groupId>org.sejda</groupId>
<artifactId>eventstudio</artifactId>
</dependency>
<dependency>
<groupId>jdepend</groupId>
<artifactId>jdepend</artifactId>
</dependency>
</dependencies>
</project>
Kindly give me a solution to this.
Two easy (possible) fixes:
Try to delete the artifact in your local repo and rebuild to trigger a download.
Use the -U maven goal to update the snapshot.
Top answer from experience, 2nd answer from:
When maven says "resolution will not be reattempted until the update interval of MyRepo has elapsed", where is that interval specified?

cannot build using jcabi parent pom

I am trying to use jcabi for logging. As I understand it is easier to inherit my pom from jcabi pom file for setup as described at http://www.jcabi.com/parent/index.html
However I get following error error on "mvn clean install" (has to do with resolving version number)
Any idea on how to resolve this or is it not recommended to inherit from jcabi pom file
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.2:
create (jcabi-build-number) on project cbm: Execution jcabi-build-number of
goalorg.codehaus.mojo:buildnumber-maven-plugin:1.2:create failed: Plugin org.codehaus
.mojo:buildnumber-maven-plugin:1.2 or one of its dependencies could not be resol
ved:
Failed to collect dependencies at org.codehaus.mojo:buildnumber-maven-plugi
n:jar:1.2 -> org.apache.maven.scm:maven-scm-api:jar:1.8 -> org.codehaus.plexus:p
lexus-utils:jar:3.0.3:
Failed to read artifact descriptor for org.codehaus.plexu
s:plexus-utils:jar:3.0.3: Could not transfer artifact org.codehaus.plexus:plexus
-utils:pom:3.0.3 from/to internal ....
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.mojo:buildnumber-maven-plugin:1.2:create (jcabi-build-number) on pro
ject cbm: Execution jcabi-build-number of goal org.codehaus.mojo:buildnumber-mav
en-plugin:1.2:create failed: Plugin org.codehaus.mojo:buildnumber-maven-plugin:1
2 or one of its dependencies could not be resolved:
Failed to collect dependencies at org.codehaus.mojo:buildnumber-maven-plugin:jar:1.2
-> org.apache.maven.sc
Posting answer here if relevant to any one
< dependencies>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.12</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.12</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-maven-plugin</artifactId>
<version>0.8</version>
<executions>
<execution>
<goals>
<goal>ajc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

maven jboss-as:start A required class was missing ... org/sonaty.../ArtifactResolutionException

I am attempting to start a jboss-as server using the mvn jboss-as:start command and simply put it won't run.
http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:start (default-cli) on project thenaglecode: Execution default-cli of goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:start failed: A required class was missing while executing org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:start: org/sonatype/aether/resolution/ArtifactResolutionException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/jxnagl/.m2/repository/org/jboss/as/plugins/jboss-as-maven-plugin/7.4.Final/jboss-as-maven-plugin-7.4.Final.jar
[ERROR] urls[1] = file:/C:/Users/jxnagl/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
...
[ERROR] urls[33] = file:/C:/Users/jxnagl/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar
[ERROR] urls[34] = file:/C:/Users/jxnagl/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.10/plexus-utils-3.0.10.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.sonatype.aether.resolution.ArtifactResolutionException
[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]
This link: '[Help 1]' from the above error log at the bottom of the trace shows that this issue is very new, not more than a day old.
the page however is not very useful to me, maybe because i am new to maven so please be nice to me, i.e. i can't figure out what dependency is failing.
Here is my pom.xml for your perusal, forgive the overkill on properties, i'm going to revert this way of doing things soon.
<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.thenaglecode</groupId>
<artifactId>thenaglecode</artifactId>
<packaging>pom</packaging>
<version>1.0.0.Pre-Alpha</version>
<modules>
<module>core</module>
<module>algorithms</module>
<module>web</module>
<module>testing</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- the nagle code properties -->
<thenaglecode.java.compiler.version>1.7</thenaglecode.java.compiler.version>
<thenaglecode.java.home>C:\Program Files\Java\jdk1.7.0_25</thenaglecode.java.home>
<thenaglecode.version>1.0.0.Pre-Alpha</thenaglecode.version>
<!-- third party library versions format: "libraries.version.<groupid>.<artifactid>" -->
<libraries.version.org.jboss.spec.jboss-javaee-6.0>3.0.2.Final
</libraries.version.org.jboss.spec.jboss-javaee-6.0>
<libraries.version.org.jboss.spec.jboss-javaee-all-6.0>3.0.2.Final
</libraries.version.org.jboss.spec.jboss-javaee-all-6.0>
<libraries.version.org.jboss.as.jboss-as-arquillian-container-remote>7.2.0.Final
</libraries.version.org.jboss.as.jboss-as-arquillian-container-remote>
<libraries.version.org.jboss.arqullian.protocol.arquillian-protocol-servlet>1.1.0.Final
</libraries.version.org.jboss.arqullian.protocol.arquillian-protocol-servlet>
<libraries.version.org.jboss.weld.weld-api>2.0.Final</libraries.version.org.jboss.weld.weld-api>
<libraries.version.org.jboss.arquillian.container.arquillian-glassfish-remote-3.1>1.0.0.CR4
</libraries.version.org.jboss.arquillian.container.arquillian-glassfish-remote-3.1>
<libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec>1.0.3.Final
</libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec>
<libraries.version.org.jboss.arquillian.arquillian-bom>1.1.1.Final
</libraries.version.org.jboss.arquillian.arquillian-bom>
<libraries.version.xalan.xalan>2.7.1</libraries.version.xalan.xalan>
<libraries.version.joda-time.joda-time>2.2</libraries.version.joda-time.joda-time>
<libraries.version.junit.junit>4.11</libraries.version.junit.junit>
<libraries.version.org.apache.commons.commons-lang3>3.1</libraries.version.org.apache.commons.commons-lang3>
<libraries.version.commons-collections.commons-collections>3.2.1</libraries.version.commons-collections.commons-collections>
<libraries.version.commons-io.commons-io>2.4</libraries.version.commons-io.commons-io>
<!-- plugins format: "plugins.version.<groupid>.<artifactid>" -->
<plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>7.4.Final</plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>
<plugins.version.org.apache.maven.plugins.maven-compiler-plugin>3.1</plugins.version.org.apache.maven.plugins.maven-compiler-plugin>
<plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>7.4.Final</plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>
</properties>
<dependencyManagement>
<dependencies>
<!-- thenaglecode projects -->
<dependency>
<groupId>com.thenaglecode</groupId>
<artifactId>core</artifactId>
<version>${thenaglecode.version}</version>
</dependency>
<dependency>
<groupId>com.thenaglecode</groupId>
<artifactId>web</artifactId>
<version>${thenaglecode.version}</version>
</dependency>
<dependency>
<groupId>com.thenaglecode</groupId>
<artifactId>algorithms</artifactId>
<version>${thenaglecode.version}</version>
</dependency>
<!-- third party libraries -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${libraries.version.org.jboss.arquillian.arquillian-bom}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-all-6.0</artifactId>
<version>${libraries.version.org.jboss.spec.jboss-javaee-all-6.0}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${libraries.version.org.apache.commons.commons-lang3}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${libraries.version.commons-collections.commons-collections}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${libraries.version.commons-io.commons-io}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${libraries.version.junit.junit}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet.jstl</groupId>
<artifactId>jboss-jstl-api_1.2_spec</artifactId>
<version>${libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec}</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>${libraries.version.xalan.xalan}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${libraries.version.joda-time.joda-time}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugins.version.org.apache.maven.plugins.maven-compiler-plugin}</version>
<configuration>
<source>${thenaglecode.java.compiler.version}</source>
<target>${thenaglecode.java.compiler.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
<configuration>
<javaHome>${thenaglecode.java.home}</javaHome>
<execute-commands/>
<executeCommands/>
</configuration>
</plugin>
</plugins>
</build>
</project>
With Maven 3.1 they switched to using eclipse aether. The jboss-as-maven-plugin uses Sonatype aether as that us what Maven 3.0.x uses. The two versions are not compatible meaning it would require two different plugins would be required. One for Maven 3.1 and one for Maven 3.0.x.
One note is, as you've seen, this only affects the run and start goals. There is no workaround for it. You have to use Maven 3.0.x until a release of the jboss-as-maven-plugin is released that will support eclipse aether.
As far as I understand this bug report : jboss-as-maven-plugin have 2 dependencies on incompatible maven plugin (dependency-plugin and enforcer-plugin).
As a workaround, I would try the following : override incompatible dependencies with newer versions known to be compatible (listed here). To do so : change your pom.xml and add the following dependencies for jboss-as-maven-plugin (i.e. NOT your project dependencies)
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
<configuration>
<javaHome>${thenaglecode.java.home}</javaHome>
<execute-commands/>
<executeCommands/>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version> <!--override 2.6-->
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3</version> <!--override 1.2-->
</dependency>
</dependencies>
</plugin>

Categories

Resources