vianna77
vianna77

Reputation: 505

Jenkins during Maven build is using the LOG4j config from a dependency instead of mine

Some background: I first run in the pre-steps of Jenkins the following command:

mvn clean install -DskipTests

The build phase will run only the tests with the JAR created in the pre-steps.

Maven was completely ignoring my log4j config and using a log4j from a dependency. To work around this problem, during the pre-steps I used the following java parameters:

java -Dlog4j.configuration=log4j-dm.xml ...

Where log4j-dm is my log4j configuration.

The problem is, when running the pom.xml in the build phase, I only pass the parameter "test" (because that's what I want in the build phase) and the log4j used is one from the dependency.

Is there a way to tell maven to use my log4j configuration?

If not, is there a way to build my JAR with dependencies packaged in their JARs so the log4j dependency don't get mixed with my log4j?

Upvotes: 1

Views: 768

Answers (1)

vianna77
vianna77

Reputation: 505

Nevermind everybody... I just figured out!

In the build section of Jenkins, I used the following:

test -Dlog4j.configuration=log4j-dm.xml

And it solved the issue!

Congrats to me :D

Upvotes: 1

Related Questions