maven 3: Accessing version of “root” corporate POM

I stopped using maven-antrun-plugin and switched to GMaven instead. I can get the info required with a simple POM hierarchy traversal. <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>groovy-maven-plugin</artifactId> <version>2.0</version> <executions> <execution> <id>echo-build-environment</id> <phase>validate</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> <![CDATA[ def rootPom = project; while (rootPom.parent != null) { rootPom = rootPom.parent; } project.properties.setProperty(‘root.pom.version’, rootPom.version); log.info(” Maven Home: ” + … Read more

How to get a command-line property to overwrite a maven property

Put parameters directly to pom from command line for example: mvn clean install -Dtestng.version=6.3.1 Example: <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.test</groupId> <artifactId>test</artifactId> <version>1.0.0</version> <name>test</name> <properties> <testng.version>6.4</testng.version> </properties> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>${testng.version}</version> <scope>test</scope> </dependency> </dependencies> </project> If you run it normally testng version 6.4 will be used. But if you run it like: mvn … Read more

Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved

Your debug output indicates that Clean is the first thing that it’s trying to run, so I’m guessing it’s failing to download any plugins from central. First off, see if you can download the plugin jar directly in a web browser: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar If that works then your web browser has connectivity to central but maven … Read more

Maven release plugin fails : source artifacts getting deployed twice

Try running mvn -Prelease-profile help:effective-pom. You will find that you have two execution sections for maven-source-plugin The output will look something like this: <plugin> <artifactId>maven-source-plugin</artifactId> <version>2.0.4</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> To fix this problem, find everywhere you have used maven-source-plugin and make sure that you … Read more