Is there a way to exclude a Maven dependency globally?

Does this help? http://jlorenzen.blogspot.com/2009/06/maven-global-excludes.html “Assuming I want to exclude avalon-framework from my WAR, I would add the following to my projects POM with a scope of provided. This works across all transitive dependencies and allows you to specify it once. <dependencies> <dependency> <artifactId>avalon-framework</artifactId> <groupId>avalon-framework</groupId> <version>4.1.3</version> <scope>provided</scope> </dependency> </dependencies> This even works when specifying it in … Read more

Maven adding mainClass in pom.xml with the right folder path

First, your main class doesn’t include src/main/java. Look at the package declaration in that Java file. For example, package org.jis;, then add the main class to that. In other words, it’s only org.jis.Main. You need to configure the maven-jar-plugin instead the of the maven-compiler-plugin. The jar-plugin is the one which is responsible for packaging and … Read more

How can I view transitive dependencies of a Maven pom.xml file?

On the CLI, use mvn dependency:tree (Here are some additional Usage notes) When running dependency:tree on multi-module maven project, use mvn compile dependency:tree instead1. Otherwise, the POM Editor in M2Eclipse (Maven integration for Eclipse) is very good, and it includes a hierarchical dependency view. 1If you don’t compile, you might get error Failed to execute … Read more

IntelliJ – Convert a Java project/module into a Maven project/module

Right-click on the module, select “Add framework support…”, and check the “Maven” technology. (This also creates a pom.xml for you to modify.) If you mean adding source repository elements, I think you need to do that manually–not sure. Pre-IntelliJ 13 this won’t convert the project to the Maven Standard Directory Layout, 13+ it will.

Verification of dependency authenticity in Maven POM based automated build systems

tl;dr: Non-existent verification mechanisms in Maven and missing language constructs in the POM’s DSL are a serious security threat. Until MNG-6026 is addressed, use someting like Gradle Witness. Introduction None of the answers provided so far seem to solve the problem. Signing artifacts is only a first step into the right direction. But the condition … Read more

repository element was not specified in the POM inside distributionManagement element or in -DaltDep loymentRepository=id::layout::url parameter

You should include the repository where you want to deploy in the distribution management section of the pom.xml. 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/xsd/maven-4.0.0.xsd”> … <distributionManagement> <repository> <uniqueVersion>false</uniqueVersion> <id>corp1</id> <name>Corporate Repository</name> <url>scp://repo/maven2</url> <layout>default</layout> </repository> … </distributionManagement> … </project> See Distribution Management