开发者

How to turn off maven dependency:analyze-only failOnWarning

开发者 https://www.devze.com 2023-03-13 08:19 出处:网络
I\'m building a java project with maven-2 and due to some dependencies listed, and others not listed, in the pom.xml file and the fact that failOnWarning is set to true in the dependency:analyze-only

I'm building a java project with maven-2 and due to some dependencies listed, and others not listed, in the pom.xml file and the fact that failOnWarning is set to true in the dependency:analyze-only mojo configuration I am not able to build the project without using the maven -fn flag.

Here is more detail.

$ mvn install -X
...snip...
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-dependency-plugin:2.0:analyze-only' -->
...snip...
[DEBUG]   (f) failOnWarning = true
[DEBUG]   (f) ignoreNonCompile = true
...snip...
[DEBUG] -- end configuration --
[INFO] [dependency:analyze-only {execution: default}]
[INFO] Used declared dependencies found:
[INFO]    javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO]    javax.servlet:servlet-api:jar:2.5:provided
[INFO]    org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO]    flexson:json:jar:1.7:compile
[INFO]    org.springframework:spring-web:jar:3.0.5.RELEASE:com开发者_如何转开发pile
[WARNING] Used undeclared dependencies found:
[WARNING]    org.springframework.security:spring-security-core:jar:3.0.5.RELEASE:compile
[WARNING]    log4j:log4j:jar:1.2.16:compile
...snip...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Dependency problems found
[INFO] ------------------------------------------------------------------------

My question is this:

How can I set failOnWarning = false without changing the pom.xml file for the project?

- The pom.xml file is checked into source control and others on the project don't need to change it to build the project so I expect there is something different about my maven setup.

- We are all using maven 2.2.1 with the same settings.xml file.


This may be a bit over the top, but could you not specify it as a property? e.g. something like <failOnWarnings>${config.failOnWarning}</failOnWarning>

Specify the property in the properties section of your POM to be true. Then you can override it to be false when you run from the command-line.

0

精彩评论

暂无评论...
验证码 换一张
取 消