maven-3

Best way to add local dependency to Maven project

こ雲淡風輕ζ 提交于 2019-12-20 16:53:41
问题 There are a lot of questions about this, but the answers seem to contradict each other. So I wanted to ask it for my version of Maven (3.0.4). I have a JAR file that's not part of any maven repository. It's a local dependency. I understand there are two ways to add it to my Maven project. Add it as a dependency and specify the file path in the <systemPath> property. (No other work needed.) Create a local repository <my-project>/repo and install the JAR in this repository. Then, add the new

How can I find out the default phase a Maven goal binds to?

谁说胖子不能爱 提交于 2019-12-20 12:29:20
问题 In Maven, how can I find out the default phase of a goal (if any default phase exists at all for this particular goal)? Example I am using a Maven plugin called Jetty Maven Plugin. It contains a goal jetty:run . Running the command mvn jetty:run (notice this command only contains a goal, not a phase) first builds a pom.xml -specified web application up to the default test-compile phase, then deploys it inside a Jetty server. As pointed out in the Mojo API Specification, a goal can have a

Declare Maven dependency as test runtime only

半城伤御伤魂 提交于 2019-12-20 11:21:41
问题 What is the best way to declare a Maven dependency as only being used for the test runtime (but not test compilation) class path? Specifically, I want slf4j-api (a logging facade) as a typical, compile-scope dependency, but I want slf4j-simple (the barebones implementation suitable for unit tests) only on the test runtime class path (it's not needed for test compilation). I've been doing this: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency>

how to exclude all artifacts from a group in maven?

为君一笑 提交于 2019-12-20 10:33:10
问题 I am using maven 3 with the Enforcer plugin configured to force version convergence. I am using Spring 3.1.2 and Spring Security 3.1.3. The problem is that Spring 3.1.3 POM declares dependencies on Spring 3.0.7 because that is the minimum version need for spring security. This means that the enforcer plugin complains because the transitive dependency graph has both Spring 3.1.2 and Spring 3.0.7 in it. The fix is to explicitly exclude spring 3.0.7 as a dependency of spring security so that the

how to exclude all artifacts from a group in maven?

不想你离开。 提交于 2019-12-20 10:31:10
问题 I am using maven 3 with the Enforcer plugin configured to force version convergence. I am using Spring 3.1.2 and Spring Security 3.1.3. The problem is that Spring 3.1.3 POM declares dependencies on Spring 3.0.7 because that is the minimum version need for spring security. This means that the enforcer plugin complains because the transitive dependency graph has both Spring 3.1.2 and Spring 3.0.7 in it. The fix is to explicitly exclude spring 3.0.7 as a dependency of spring security so that the

Non-resolvable parent POM: When building Maven 3 Project Site

狂风中的少年 提交于 2019-12-20 10:29:10
问题 I am currently facing the following problem with Maven 3 when I am trying to build the site. I will appreciate you help on this. mvn clean site .......... [INFO] Reactor Summary: [INFO] [INFO] Project A ......................................... SUCCESS [15.383s] [INFO] Project B ......................................... SUCCESS [2.232s] [INFO] My Site ........................................... FAILURE [0.105s] [INFO] ------------------------------------------------------------------------

How to programatically invoke a maven dependency plugin

99封情书 提交于 2019-12-20 10:23:37
问题 I am trying to invoke maven-dependency-plugin programatically. i am using maven 3 version. the problem is that when i invoke it through pluginManager.executeMojo(session, execution), i receive the following error message: [ERROR] **The parameters 'project', 'local', 'remoteRepos', 'reactorProjects' for goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack are missing or invalid** **org.apache.maven.plugin.PluginParameterException: The parameters 'project', 'local', 'remoteRepos',

Maven - Detect Multiple Versions of the Same Dependency

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 09:37:17
问题 I just experienced a case of two direct dependencies of my maven project having two different versions of a particular transitive dependency. In my particular case I had direct dependencies on the following: <dependency> <groupId>org.jclouds.driver</groupId> <artifactId>jclouds-sshj</artifactId> <version>${jclouds.version}</version> </dependency> and <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-jersey</artifactId> <version>${mule.version}</version> </dependency>

Maven POM file for installing multiple 3rd party commercial libraries

倾然丶 夕夏残阳落幕 提交于 2019-12-20 09:00:00
问题 I have a bunch of projects which are dependant on a set of commercial 3rd party libraries. We currently don't have a company repository so I have to install the libraries in my own local repo. Running mvn install:installFile -Dpackaging=jar -Dfile=<file> -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version> for each file is rather tedious. Could create a bat file, but is there a way to do this using maven? I'm thinking a project for all the jars and a single pom file with all the

difference between keeping a plugin inside a project and inside a profile

女生的网名这么多〃 提交于 2019-12-20 05:24:29
问题 Can anyone please explain the functionality for below? A) Actually below code is working for me, BUT I didnt understood why we need to use below for maven-war-plugin <warSourceDirectory>src/main/webapp</warSourceDirectory> <webXml>src/main/webapp/WEB-INF/web.xml</webXml> B) whats the difference between keeping a plugin inside a project and inside a profile? ( say maven-surefire-plugin ) which way is better (assume I MUST use <profile> tag in my pom.xml) 回答1: Part A warSourceDirectory is