Fail of org.apache.maven.plugins goal execution - maven

I'm trying to generate a war file using maven but i'm getting this error (most of downloading log output is omitted to make log more clear):
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.pom
Downloaded:
...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tn.talan.selenium Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # tn.talan.selenium ---
...
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # tn.talan.selenium ---
...
[INFO] --- maven-war-plugin:2.1.1:war (default-cli) # tn.talan.selenium ---
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.pom
Downloaded:
...
[INFO] BUILD FAILURE
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-cli) on project tn.talan.selenium: Execution default-cli of goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed: Plugin org.apache.maven.plugins:maven-war-plugin:2.1.1 or one of its dependencies could not be resolved: Could not transfer artifact org.codehaus.plexus:plexus-io:jar:1.0.1 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar from central failed: Read timed out -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
...
Here's my pom.xml file code:
<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>selenium</groupId>
<artifactId>tn.talan.selenium</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>tn.talan.selenium 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>tn.talan.selenium</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
</project>
What's wrong with my pom? Any idea please?

Specify version for maven-war-plugin, e.g.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>

For solving this error, you don't need to do anything, just change your jdk version. You can prefer any jdk version but don't prefer latest one.Try to use older version. Recommended : JDK 11.0.11

Related

Publish additional external jar-files to ossrh with maven

I want to publish my projects artifacts with maven to nexus. Therefore I followed this documentation which works for me for artifacts which are also build with maven. But now I want to publish additional artifacts (*.tgz files) which I download from somewhere else. I have not yet found out how to express in maven terms that I want to deploy those "local" artifacts.
What I tried is:
Create a new staging repo on ossrh with the pom file. This works and a new, open staging repository is created containing the pom file and a signature file.
> mvn deploy -DrepositoryId=ossrh
upload additional resources. This fails
> mvn deploy:deploy-file -Dfile=test-tst-0.0.1_linux-ppc64le_bin.tar.gz -Dclassifier=linux-ppc64le -DrepositoryId=ossrh -Durl=https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031 -DgroupId=io.sapmachine -DartifactId=test-tst -Dversion=0.0.1
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< io.sapmachine:test-tst >-----------------------
[INFO] Building io.sapmachine:test-tst 0.0.1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) # test-tst ---
Uploading to ossrh: https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031/io/sapmachine/test-tst/0.0.1/test-tst-0.0.1-linux-ppc64le.gz
Uploading to ossrh: https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031/io/sapmachine/test-tst/0.0.1/test-tst-0.0.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.002 s
[INFO] Finished at: 2021-12-08T09:02:40+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project test-tst: Failed to deploy artifacts: Could not find artifact io.sapmachine:test-tst:gz:linux-ppc64le:0.0.1 in ossrh (https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031) -> [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
My pom.xml looks like this:
> cat 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">
<groupId>io.sapmachine</groupId>
<artifactId>test-tst</artifactId>
<version>0.0.1</version>
<name>${project.groupId}:${project.artifactId}</name>
<description>Test</description>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<url>https://test.io/</url>
<licenses>
<license>
<name>GPLv2 + Classpath Exception</name>
<url>https://test/LICENSE</url>
</license>
</licenses>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
<developers>
<developer>
<name>Test</name>
<email>test#test.com</email>
<organization>Test AG</organization>
<organizationUrl>http://www.test.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/test/tree/test-${project.version}</connection>
<url>http://github.com/test/tree/test-${project.version}</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
>

Plugin org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6 or one of its dependencies could not be resolved

I'm new to GWT and Maven and I was creating a new Maven project and then customizing it using the steps mentioned in this link: Setting and Customizing your Project.
I followed all the steps given in the Customizing your Project section on that page but while running the project in the SuperDevMode, I got many errors in Command Prompt and I don't understand how to resolve those errors even after searching on the Internet.
Here is my pom.xml file:
<?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">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.gwtproject.tutorial</groupId>
<artifactId>TodoList</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>org.gwtproject.tutorial.TodoList</name>
<properties>
<!-- Setting maven.compiler.source to something different to 1.8
needs that you configure the sourceLevel in gwt-maven-plugin since
GWT compiler 2.8 requires 1.8 (see gwt-maven-plugin block below) -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Don't let your Mac use a crazy non-standard encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- ensure all GWT deps use the same version (unless overridden) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>2.8.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin.polymer</groupId>
<artifactId>vaadin-gwt-polymer-elements</artifactId>
<version>1.7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" update them in DevMode -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-6</version>
<executions>
<execution>
<goals>
<goal>import-sources</goal>
<goal>compile</goal>
<goal>import-test-sources</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<moduleName>org.gwtproject.tutorial.TodoList</moduleName>
<moduleShortName>TodoList</moduleShortName>
<failOnError>true</failOnError>
<jsInteropMode>JS</jsInteropMode>
<!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if you use
a different source language for java compilation -->
<sourceLevel>1.8</sourceLevel>
<!-- Compiler configuration -->
<compilerArgs>
<!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
<arg>-compileReport</arg>
<arg>-XcompilerMetrics</arg>
</compilerArgs>
<!-- DevMode configuration -->
<warDir>${project.build.directory}/${project.build.finalName}</warDir>
<classpathScope>compile+runtime</classpathScope>
<!-- URL(s) that should be opened by DevMode (gwt:devmode). -->
<startupUrls>
<startupUrl>TodoList.html</startupUrl>
</startupUrls>
</configuration>
</plugin>
<!-- Skip normal test execution, we use gwt:test instead -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Here's what I got in Command Prompt.
C:\Users\TEST>cd TodoListApp
C:\Users\TEST\TodoListApp>mvn war:exploded
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/gwt-maven-plugin/1.0-rc-6/gwt-maven-plugin-1.0-rc-6.pom
[WARNING] The POM for org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/gwt-maven-plugin/1.0-rc-6/gwt-maven-plugin-1.0-rc-6.jar
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6: Plugin org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6 or one of its dependencies could not be resolved: Could not find artifact org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 in central (https://repo.maven.apache.org/maven2)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building org.gwtproject.tutorial.TodoList 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6: Plugin org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6 or one of its dependencies could not be resolved: Failure to find org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO]
[INFO] --- maven-war-plugin:2.2:exploded (default-cli) # TodoList ---
[INFO] Exploding webapp
[INFO] Assembling webapp [TodoList] in [C:\Users\TEST\TodoListApp\target\TodoList-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\TEST\TodoListApp\src\main\webapp]
[INFO] Webapp assembled in [66 msecs]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.198 s
[INFO] Finished at: 2017-08-29T14:24:43+05:30
[INFO] Final Memory: 14M/133M
[INFO] ------------------------------------------------------------------------
C:\Users\TEST\TodoListApp>mvn gwt:devmode
[INFO] Scanning for projects...
[WARNING] The POM for org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6: Plugin org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6 or one of its dependencies could not be resolved: Failure to find org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[WARNING] The POM for org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.316 s
[INFO] Finished at: 2017-08-29T14:24:53+05:30
[INFO] Final Memory: 7M/106M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.codehaus.mojo:gwt-maven-plugin:1.0-rc-6 or one of its dependencies could not be resolved: Failure to find org.codehaus.mojo:gwt-maven-plugin:jar:1.0-rc-6 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be 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
I edited the groupId of GWT Maven Plugin as "org.codehaus.mojo" by seeing the one written in that GWT page and I don't remember now what was the groupId initially. Please help me to fix this error.
The version of your plugin is wrong; Please replace it with 2.8.1. Like this:
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.8.1</version>
</dependency>

Maven build - Unable to get resource

I am doing maven clean build , and I am getting the below exception.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building App
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/10/maven-plugins-10.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-plugins:pom:10' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/10/maven-plugins-10.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-plugins:pom:10' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:maven-clean-plugin:maven-plugin:2.2
Reason: Cannot find parent: org.apache.maven.plugins:maven-plugins for project: null:maven-clean-plugin:maven-plugin:2.2 for project null:maven-clean-plugin:maven-plugin:2.2
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Sep 30 12:21:41 IST 2014
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
my settings.xml is as below ,
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2</url>
</mirror>
</mirrors>
and my pom.xml is as below,
<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.myapp</groupId>
<artifactId>ExtJsApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>App</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<finalName>App</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>
</plugins>
</build>
</project>
any one please help me out of this. I have the same settings.xml in my .m2 folder.

Maven build not finding custom jar already installed in local openshift project repo

I am facing an issue when trying to build my project (from the Eclipse Openshift plugin).
1.) I have a custom dependency, which at first I followed instructions on Open Shift Knowledgebase Article "Using your own jar files..."
2.) On commit and publish with above, the error still persisted, thereby I changed the openshift pre_build action hook as noted in this post on the Openshift forums "Resolved custom jar dependency..."
However, I am still getting an error on commit and publish from eclipse. Here's a dump from the console
Repository ssh://53211e7...50000f0#testapp0...312-systix.rhcloud.com/~/git/testapp0...312.git/
Stopping RockMongo cartridge
[Sun Mar 16 12:20:37 2014] [warn] module php5_module is already loaded, skipping
httpd (no pid file) not running
MongoDB already stopped
Stopping jbossas cartridge
Repairing links for 1 deployments
Building git ref 'master', commit bb2def3
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) # standalone-pom ---
[INFO] Installing /var/lib/openshift/app-root/runtime/repo/shared-helper-data-skychart-0.0.1-SNAPSHOT.jar to /var/lib/openshift/53211e...0f0/.m2/repository/com/systix/shared-helper-data-skychart/0.0.1-SNAPSHOT/shared-helper-data-skychart-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.331s
[INFO] Finished at: Sun Mar 16 12:20:48 EDT 2014
[INFO] Final Memory: 4M/78M
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) # standalone-pom ---
[INFO] Installing /var/lib/openshift/app-root/runtime/repo/shared-models-skychart-0.0.1-SNAPSHOT.jar to /var/lib/openshift/5321......00f0/.m2/repository/com/systix/shared-models-skychart/0.0.1-SNAPSHOT/shared-models-skychart-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.723s
[INFO] Finished at: Sun Mar 16 12:20:53 EDT 2014
[INFO] Final Memory: 4M/78M
[INFO] ------------------------------------------------------------------------
Found pom.xml... attempting to build with 'mvn -e clean package -Popenshift -DskipTests'
Apache Maven 3.0.3 (r1075437; 2011-06-20 13:22:37-0400)
Maven home: /etc/alternatives/maven-3.0
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-431.5.1.el6oso.bz844450.x86_64", arch: "i386", family: "unix"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testapp0...312 1.0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.134s
[INFO] Finished at: Sun Mar 16 12:21:04 EDT 2014
[INFO] Final Memory: 5M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project testapp0...0312: Could not resolve dependencies for project testapp0...0312:testapp0...312:war:1.0: Could not find artifact com.systix:shared-helper-data-skychart:jar:0.0.1-SNAPSHOT -> [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/DependencyResolutionException
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/5321...00f0/jbossas
For more details about the problem, try running the command again with the '--trace' option.
On reviewing the above it seems like maven is able to add the dependency jars succesfully to the local repo ,but the build for the project does not seem to.
UPDATE: Including the pom.xml from both the libraries that I have marked as to be installed in the pre_build file. Both the jars were built, included in the openshift git repo, and referenced in the pre_build script to be installed in openshift's maven repo (pre_build script included at end)
pom.xml from shared-helper-data-skychart:
<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.systix</groupId>
<artifactId>shared-helper-data-skychart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.4</version>
</dependency>
<dependency>
<groupId>com.systix</groupId>
<artifactId>shared-models-skychart</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>0.105</version>
</dependency>
</dependencies>
</project>
pom.xml from shared-models-skychart (shared-models-skychart is a dependency in the pom.xml for shared-helper-data-skychart)
<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.systix</groupId>
<artifactId>shared-models-skychart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>0.105</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.4</version>
</dependency>
</dependencies>
</project>
pre_build script used
mvn install:install-file -Dfile=../app-root/runtime/repo/shared-helper-data-skychart-0.0.1-SNAPSHOT.jar -DgroupId=com.systix -DartifactId=shared-helper-data-skychart -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
mvn install:install-file -Dfile=../app-root/runtime/repo/shared-models-skychart-0.0.1-SNAPSHOT.jar -DgroupId=com.systix -DartifactId=shared-models-skychart -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
UPDATE 2: Also, the above pom.xml is what I have in my project code files. However, when I ssh intoopenshift servers and review the local maven repos, the following is what I see as pom.xml
cat ./.m2/repository/com/systix/shared-helper-data-skychart/0.0.1-SNAPSHOT/shared-helper-data-skychart-0.0.1-SNAPSHOT.pom
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>com.systix</groupId>
<artifactId>shared-helper-data-skychart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>POM was created from install:install-file</description>
</project>
This is what worked for me:
I connected via SSH to OpenShift like described here.
There I found out that in the OpenShift maven repo (under ~/.m2/repository/) the jar had not been installed correctly. In the dependency directory there were *.jar.lastUpdated files instead of the actual jars.
I deleted the whole directory of the problematic dependency from the maven repo (manually)
In my pre_build action hook I changed mvn install:install -Dfile path to an absolute path to the jar (e.g. /var/lib/openshift/___your__id__here____/app-root/runtime/repo/dependencyfile.jar
I pushed my local changes (pre_build action hook changed in point 4.) to the git repo. Now all worked fine :)

Why is PMD OK from command line, but does not work from within Maven?

After many years of successful use of PMD with Ant, I am now trying without success to get PMD to work from within Maven.
To illustrate my problem, I have created a simple Maven system (based upon the Maven tutorial "my-app" hello world program). It differs only in the inclusion of a line of code which should trigger a PMD error using the basic ruleset:
Boolean bar = new Boolean("true");
When I run PMD from the command line, the problem in the code is revealed:
run.sh pmd -d src/main/java -f text -R rulesets/java/basic.xml -language java
maven-pmd-example/src/main/java/com/mycompany/app/App.java:11 Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead.
However, when I run pmd from within Maven, the problem in the code is not revealed:
-> mvn pmd:check
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-pmd-plugin:2.7.1:check (default-cli) # my-app >>>
[INFO]
[INFO] --- maven-pmd-plugin:2.7.1:pmd (pmd) # my-app ---
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO]
[INFO] <<< maven-pmd-plugin:2.7.1:check (default-cli) # my-app <<<
[INFO]
[INFO] --- maven-pmd-plugin:2.7.1:check (default-cli) # my-app ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.375s
[INFO] Finished at: Sun Feb 03 15:38:02 HST 2013
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
Here is the 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>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-app</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>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.7.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<minimumPriority>0</minimumPriority>
<rulesets>
<ruleset>rulesets/basic.xml</ruleset>
</rulesets>
<targetJdk>1.6</targetJdk>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</build>
</project>
I have uploaded this example system to GitHub so you can see the entire example system (and download/play with it if you would like):
https://github.com/philipmjohnson/maven-pmd-example
It's because you have set the minimumPriority to 0, which will effectively prevent PMD from evaluating any rules at all (refer to this SO question for a discussion on priority).
Please refer to this section of the goal documentation for the PMD plugin for more information.
I'd suggest modifying the configuration to set the minimumPriority to 2 so that you can fail the build for BooleanInstantiation.
Hope this helps!

Resources