Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>if youre following maven conventions then your test classes are under <code>src/test/java</code>. maven never packages the contents of the test sources subdirectory into the artifact.</p> <p>you have (at least ...) 3 alternativs:</p> <p><strong>put the tests with the "normal" sources</strong></p> <p>if you <em>REALLY</em> want them packaged (why?) then you should place the test classes under <code>src/main/java</code> where they will be treated as normal source and their compiled classes packaged into the artifact (usually *.jar)</p> <p>you imght run into all sorts of issues doing this. for example your artifact will have a compile-scoped dependency on junit, which might interfere with other modules using your jar.</p> <p>also, you might have to configure the maven plugins running the tests to be aware of your test classes if you do this (that is if you ever do want to run tests as part of your build). for example the surefire and failsafe plugins.</p> <p><strong>configure the maven jar plugin to build a tests jar</strong></p> <p>see the <a href="http://maven.apache.org/plugins/maven-jar-plugin/usage.html" rel="nofollow noreferrer">maven jar plugin documentation</a>. they even have a section titled "How to create a jar containing test classes" - the instructions there will cause your tests to be packaged into a separate jar file (which is probably a much better idea).</p> <p><strong>create the jar your way using the assembly plugin directly</strong></p> <p>yuo could <a href="https://stackoverflow.com/questions/4101750/disable-the-execution-default-jar">disable the default execution of the jar plugin</a> and instead add an execution of the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/" rel="nofollow noreferrer">assembly plugin</a> to the package phase to create a jar. you will need to write an <a href="http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html" rel="nofollow noreferrer">assembly descriptor</a> for this (not as complicated as the above link makes it out to be). this will give yu full control over what get included in the jar produced. its best to start by copying one of the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html" rel="nofollow noreferrer">predefined assemblies</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload