How can I use a default value if an environment variable isn’t set for resource filtering in maven?

I’m using the profile for determining as <profiles> <profile> <activation> <activeByDefault>true</activeByDefault> <property> <name>!myproperty</name> </property> </activation> … <properties> <myproperty>some value</myproperty> </properties> </profile> … </profiles> Please note The activeByDefault is set to true with purpose to enable it by default. The !myproperty means this property is missing or not existed. If the myproperty is not existed, just … Read more

Failed to deploy artifacts: Could not find artifact

Have you tried to add the server in your settings.xml file? The default settings xml is located in your ~/.m2/ directory. Should contain something like that: <servers> <server> <id>my-internal-nexus-repo</id> <username>yourUserName</username> <password>yourPassword</password> </server> </servers> Here is a link to the http://maven.apache.org/settings.html maven doc for adding servers. One other thing which might be a shot in the … Read more

Interpreting “omitted for conflict” in maven 2 dependency tree

I’ve found the answer by myself at http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html: “if two dependency versions are at the same depth in the dependency tree, until Maven 2.0.8 it was not defined which one would win, but since Maven 2.0.9 it’s the order in the declaration that counts: the first declaration wins”. It seems a very questionable strategy to … Read more

How to create a project using maven-archetype-plugin? What is artefactId etc?

mvn archetype:generate command is used to create a project from an existing template. There are several archetype’s defined by many developers and project groups. When you run the command, maven does following things: Downloads maven-archetype-plugin’s latest version. Lists all archetype’s that can be used to create a project from. If you defined an archetype while … Read more

How do I provide URL access to the latest snapshot of an artifact in Nexus 2.x?

Please note this answer relates to Nexus 2.X There is a noticeable performance impact of using the restlet API to download large artifacts, see: https://community.sonatype.com/t/slow-artefacts-download-performance-with-oss-2-x/2280 The core Nexus “redirect” REST API can be used to retrieve any version of an artifact from a nominated repository: For example: https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST The v parameter can be a value … Read more

Can I configure multiple plugin executions in pluginManagement, and choose from them in my child POM?

You’re correct, by default Maven will include all of the executions you have configured. Here’s how I’ve dealt with that situation before. <pluginManagement> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>some-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>first-execution</id> <phase>none</phase> <goals> <goal>some-goal</goal> </goals> <configuration> <!– plugin config to share –> </configuration> </execution> <execution> <id>second-execution</id> <phase>none</phase> <goals> <goal>other-goal</goal> </goals> <configuration> <!– plugin config to share … Read more

How do I remove colors from Maven output?

Thanks to khmarbaise for his/her answer in the comment to my question: you can simply define -B for –batch-mode which will turn off using of colors.. This fixed the issue, my output now looks like this (much nicer): [INFO] ———————————————————————— [INFO] BUILD SUCCESS [INFO] ———————————————————————— [INFO] Total time: 17.507 s [INFO] Finished at: 2017-04-27T05:30:07-04:00 [INFO] … Read more