What classpath does maven set for different goals? Can you provide a link to official docs?

Christian

To what does Maven set the classpath for different goals?

My issue: I have a project that I am building in Jenkins. It gets checked out form SVN. As the next thing, a different file is checked out into workspace-root/mydir/my.properties

Then, maven test is run.

In the test, a class loads the file by searching it on the classpath. Why does that work? (I'm new to Jenkins and maven and am trying to figure out how the job I'm looking at works...)

carlspring

Maven uses the <dependencies/> defined in your project as puts them on the classpath of the plugins. Furthermore, in the <plugin/> section of each plugin, you can define additional <dependencies/> which are only to be used by the plugin (and will therefore not become part of the final artifact in any way, or visible on the mvn dependency:tree).

In regards to the tests, it's important to know that:

  • Resources under src/main/resources and src/test/resources are respectively copied to target/classes and target/test-classes. These two directories are added to your classpath. (The same is valid for src/main/java and src/test/java).

  • Each Maven plugin is executed in it's own classloader.

  • When executing tests, the maven-surefire-plugin will usually fork your tests into a separate classloader.

Check this link.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Different Maven configurations for different goals

What are the official perl docs on the web?

maven to package app jar, create project classpath, goals

What are Maven goals and phases and what is their difference?

What will happen if set java_home and classpath to different java version?

What does Google Play do with the Privacy Policy Link I provide it with?

Jenkins does not execute goals for maven project

How to set classpath for a maven project

Provide link to open in different browser

Elm docs - What does "a" mean?

What is CAN and how to provide it

What does "java -classpath .:" mean?

Can you override what == does in Javascript?

Can you explain what this code does?

Can you explain me what this method does?

Can you set different log levels for different routes in Phoenix?

Can you actually link constraints to utterly different view controllers?

Can you write OpenGL shader in different file and later link it to the program?

Why does the Android Instrumented Test example from the official docs not work?

What is the difference between running maven goals from console and from jenkins

What is Channeling in MiniZinc? Can you provide an simple example to explain Channeling? Finally, What is Inverse?

You must set the ES_CLASSPATH var

What are the different frontends that can be set with OneupUploaderBundle?

Dynamically set Maven Surefire JVM classpath

cannot set classpath with maven-assembly-plugin

after correcting the problems, you can resume the build with the command mvn <goals>

How can I have a Maven dependency on the runtime classpath but not the test classpath?

Can you use a const value in docs in Rust?

What does HDFS provide to HBase?