maven generating pom file

This is an old question, but was a serious PITA for me for a few minutes, so I thought I’d share: I just ran into this problem, and I believe that the issue is probably platform-dependent. The real tip-off was that the solution from Cyril’s answer wasn’t working as expected: despite my specification of -DgroupId=com.xyz … 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

Declare Maven dependency as test runtime only

There is no scope that does exactly what you want here; test is the best available option. A test-runtime scope has been requested before (Re: Need for a test-runtime scope?) and the suggested workaround is exactly the ignoreNonCompile configuration you’ve already discovered. dependency:analyze already has some limitations (“some cases are not detected (constants, annotations with … Read more

How can I configure encoding in Maven?

OK, I have found the problem. I use some reporting plugins. In the documentation of the failsafe-maven-plugin I found, that the <encoding> configuration – of course – uses ${project.reporting.outputEncoding} by default. So I added the property as a child element of the project element and everything is fine now: <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> See also … Read more

Upgrading Maven on Mac

To upgrade to the latest version (if you have one already installed but need to update the version) do the following: 1. brew update 2. brew unlink maven 3. brew install maven if you then execute the mvn –version command you should see that your version of maven has been upgraded. EDIT: If you have … Read more

How can I include test classes into Maven jar and execute them?

You should not access test classes from your application code, but rather create a main (the same main) in the test scope and create an additional artifact for your project. However, in this additional artifact (jar) you would need to have: The test classes The application code classes External dependencies required by application code (in … Read more

Maven Cobertura plugin not generating coverage.xml

Add below lines to your application Goals:(configure section of the application in jenkins) cobertura:cobertura -Dcobertura.report.format=xml pom.xml changes: <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.6</version> <configuration> <formats> <format>html</format> <format>xml</format> </formats> </configuration> </plugin> </plugins>

Getting maven project version and artifact ID from pom while running in Eclipse

Create a property file src/main/resources/project.properties with the below content version=${project.version} artifactId=${project.artifactId} Now turn on maven resource filtering <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> so that this file is processed into target/classes/project.properties with some content similar to this version=1.5 artifactId=my-artifact Now you can read this property file to get what you want and this should work every time. … Read more