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.
Related
I am facing below error while building code Spring Boot and Apache Avro example from STS, however if I run this code command line it works well.
[INFO] [1m--- [0;32mmaven-compiler-plugin:3.8.1:compile[m [1m(default-compile)[m # [36mavroposgen[0;1m ---[m
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to E:\Kafka-Streams-with-Spring-Cloud\avroposgen\target\classes
[INFO] [1m------------------------------------------------------------------------[m
[INFO] [1;31mBUILD FAILURE[m
[INFO] [1m------------------------------------------------------------------------[m
[INFO] Total time: 5.729 s
[INFO] Finished at: 2021-12-15T22:00:20+05:30
[INFO] [1m------------------------------------------------------------------------[m
[ERROR] Failed to execute goal [32morg.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile[m [1m(default-compile)[m on project [36mavroposgen[m: [1;31mFatal error compiling[m: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module #0x18ff1520) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module #0x18ff1520 -> [1m[Help 1][m
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[ERROR] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>learningjournal.guru.examples</groupId>
<artifactId>avroposgen</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Avro Pos Generator</name>
<description>Avro Pos Generator by Learning Journal</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.8.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<sourceDirectory>src/main/avro</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<imports>
<import>${project.basedir}/src/main/avro/LineItem.avsc</import>
<import>${project.basedir}/src/main/avro/DeliveryAddress.avsc</import>
</imports>
<stringType>String</stringType>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>confluent</id>
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>
</project>
In eclipse go to->
Step 1 : window->preference->java->complier-> set compiler compliance level to 1.8 if you are using jdk1.8 or java8
Step 2:window->preference->java->installed JREs->
EDIT(if your installed JRE is not being used)->
JRE HOME : (the one which you have installed in your system jre path
should be that of inside jdk)
in my case it is-> C:\Program Files\Java\jdk1.8.0_291\jre
Please try to change these config of your ide.
Seems your compiler or jre version is not matched in ide as per installed
java version.
I am having an issue with using AWS CodeCommit. My code compiles on my local using mvn clean install, however it doesn't work on AWS CodeCommit. During the build process it fails with "Error while executing command: mvn clean install. Reason: exit status 1". Below are both my pom.xml and buildspec.yml files. Just wondering if there's something obvious I'm missing.
Thanks in advance.
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws-core -->
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<type>maven-plugin</type>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-user -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-dev -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.9.0</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.smartgwt/smartgwt -->
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.5-patch</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.12.96</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
buildspec.yml:
version: 0.2
phases:
build:
commands:
- mvn clean install
Edit:
Here are the last lines of the console output:
Downloaded from central: https://repo.maven.apache.org/maven2/org/glassfish/jaxb/txw2/2.3.2/txw2-2.3.2.jar (72 kB at 370 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.10.5/ant-1.10.5.jar (2.2 MB at 11 MB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.5.1/maven-plugin-annotations-3.5.1.jar (14 kB at 73 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/jakarta/activation/jakarta.activation-api/1.2.1/jakarta.activation-api-1.2.1.jar (44 kB at 224 kB/s)
[INFO] Created EpisodePath [/codebuild/output/src412799936/src/target/generated-sources/jaxb/META-INF/JAXB]: true
[INFO] Ignored given or default xjbSources [/codebuild/output/src412799936/src/src/main/xjb], since it is not an existent file or directory.
[INFO] Ignored given or default sources [C:/Users/Maks/Desktop/PJGreen Stuff/spring-boot/src/main/resources/countries.xsd], since it is not an existent file or directory.
[WARNING] No XSD files found. Please check your plugin configuration.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.399 s
[INFO] Finished at: 2021-10-28T23:06:30Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.5.0:xjc (xjc) on project spring-boot: : MojoExecutionException: NoSchemasException -> [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/MojoExecutionException
[Container] 2021/10/28 23:06:31 Command did not exit successfully mvn clean install exit status 1
[Container] 2021/10/28 23:06:31 Phase complete: BUILD State: FAILED
[Container] 2021/10/28 23:06:31 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: mvn clean install. Reason: exit status 1
[Container] 2021/10/28 23:06:31 Entering phase POST_BUILD
[Container] 2021/10/28 23:06:31 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2021/10/28 23:06:31 Phase context status code: Message:
I am new hear but i have gone through numerous posts and websites and finally am posting as I am not sure what else to do. Please excuse if the formatting or the way i have posted is not correct. 1st time here as i said.
If i directly run mvn clean package deploy the build is successful.
But fails when i run the build from jenkins.
I am getting the following error in Jenkins when trying to run a build
Downloaded from central: http://localhost:8081/artifactory/first-libs-release/org/apache/maven/plugins/maven-release-plugin/2.5.3/maven-release-plugin-2.5.3.jar (53 kB at 3.5 MB/s)
[WARNING] The POM for org.apache.maven.plugins:maven-release-plugin:jar:3.8.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.785 s
[INFO] Finished at: 2021-09-20T21:12:36+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-release-plugin:3.8.2 or one of its dependencies could not be resolved: org.apache.maven.plugins:maven-release-plugin:jar:3.8.2 was not found in http://localhost:8081/artifactory/first-libs-release during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [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
Build step 'Conditional steps (multiple)' marked build as failure
Finished: FAILURE
my pom.xml below:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>devops</artifactId>
<version>0.1.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>devops</name>
<description>DevOps demo project</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>central</id>
<name>first-libs-release</name>
<url>http://localhost:8081/artifactory/first-libs-release</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>first-libs-snapshot</name>
<url>http://localhost:8081/artifactory/first-libs-snapshot</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:git:git#github.com:rahul-9911/devops.git</connection>
<developerConnection>scm:git:git#github.com:rahul-9911/devops.git</developerConnection>
<url>git#github.com:rahul-9911/devops.git</url>
<tag>HEAD</tag>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.8.2</version>
<configuration>
<tagNameFormat>v#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
</project>
Ok finally found the problem.
The maven-release-version was incorrect. Already knew as pointed by #khmarbaise but WHICH ONE?
After a day of struggling I realized it was the pom.xml on GIT that was being pulled.
This one had the wrong version 3.8.2
So I corrected the POM.XML on GIT and corrected the release version.
FINALLY a success!!
So I was trying to go ahead and create a .ear file for an existing maven project and further deploy it on WebLogic server. For the same, I went ahead to create the WAR,JAR and the EAR module and followed these steps for it -
Right click on parent project, select new, select maven module, Named it as projectnameJARModule and then finished the wizard.
Did the same process for creating a projectnameWARModule and a projectnameEARModule module. Once they were made, I added the WAR and the JAR modules as dependencies to the EAR module.Further, I went ahead to install the maven modules by Right Clicking on the projectnameWARModule folder and chose Run As - Maven Install. Upon this, I get the following error in the console (Full console log below) -
T E S T S
-------------------------------------------------------
Running org.CADJARModule.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # CADJARModule ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] projectname ............................................... SUCCESS [ 0.957 s]
[INFO] projectnameJARModule ...................................... FAILURE [ 33.425 s]
[INFO] projectnameWARModule Maven Webapp ......................... SKIPPED
[INFO] projectnameEARModule ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.806 s
[INFO] Finished at: 2015-12-01T18:16:20+05:30
[INFO] Final Memory: 9M/126M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project projectnameJARModule: Error assembling JAR: For artifact {org.glassfish.jersey.containers:jersey-container-servlet-core:null:jar}: The version cannot be empty. -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :projectnameJARModule
Any idea how do I get rid of this? Many Thanks
Following is the pom.xml for the Parent Module -
<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>Project_name</groupId>
<artifactId>Project_name</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Project_name</name>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version> <!-- Put here the version of your Java EE app, in my case 7.0 -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<jersey.version>2.16</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>Project_nameJARModule</module>
<module>Project_nameWARModule</module>
<module>Project_nameEARModule</module>
</modules>
</project>
Following is the pom.xml for the WAR Module-
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>Projectname</groupId>
<artifactId>Projectname</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>ProjectnameWARModule</groupId>
<artifactId>ProjectnameWARModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ProjectnameWARModule Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>ProjectnameWARModule</finalName>
</build>
</project>
Following is the pom.xml for my JAR module -
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>Project_Name</groupId>
<artifactId>Project_Name</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>CADJARModule</groupId>
<artifactId>CADJARModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>CADJARModule</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>
</dependencies>
</project>
Let me clarify: the dependencyManagement section provide dependencies governance to the same POM where it is defined and to children/modules Maven projects.
However, declaring a dependency in the dependencyManagement section doesn't mean Maven will use it, it's just an hint in case Maven will use it so that if a certain version is missing in the dependencies section, Maven will look it up in the dependencyManagement section. If none is found then, an error will be generated (Maven couldn't know which version to resolve for a certain dependency).
Hence, good to have the dependencyManagement section for governance, but it should always define versions of each dependency, otherwise it would be a missed opportunity and make your build more error-prone.
If you need all of the declared dependencies and only in the scope of the same declaring POM, then you can actually avoid to have a dependenciesManagement section at all and just have your dependencies section providing versions for each declared dependency.
In this case, you are using a dependenciesManagement section in your parent POM (I see it has modules), you should then check if in the jar module the same dependency is declared (if required), otherwise it will not be used during its build. Moreover, you should also check whether another dependenciesManagement section is declared in the concerned module and re-declaring the same dependency again without version.
Some additional helps can be provided by:
Running your Maven build using the -e -X flags
Running mvn dependency:tree -Dincludes=<concerned_group_id_here>
Last change option, run your build as mvn dependency:purge-local-repository clean install, which can work in case of corrupted cache (error should be different though)
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>