Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/site/apt/examples/create-test-jar.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ How to create a jar containing test classes
When you want to create a jar containing <test-classes>, you would probably want to reuse those classes.
There are two ways to solve this:

* Create an attached jar with the <test-classes> from the current project and loose its transitive <<<test>>>-scoped dependencies.
* Create an attached jar with the <test-classes> from the current project and lose its transitive <<<test>>>-scoped dependencies.

* Create a separate project with the <test-classes>.

Expand Down Expand Up @@ -66,7 +66,7 @@ How to create a jar containing test classes
</project>
+-----------------+

To reuse this artifact in an other project, you must declare this dependency with type test-jar :
To reuse this artifact in another project, you must declare this dependency with type test-jar :

+-----------------+
<project>
Expand All @@ -85,20 +85,20 @@ How to create a jar containing test classes
</project>
+-----------------+

Based on such configuration there will be two jar files generated. The first one contains the
Based on such configuration, two jar files will be generated. The first one contains the
classes from <<<src/main/java>>> whereas the second one will contain the classes from <<<src/test/java>>>.
The generated jar files follow the naming schema <<<artifactId-version.jar>>> for the first one and
<<<artifactId-version-classifier.jar>>> for the second one. The parts <<<artifactId>>>, <<<versions>>>
will be replaced by the values given within your project <<<pom.xml>>> file. The <<<classifier>>>
will be set to <<<tests>>> which is a default of the maven-jar-plugin which can be changed if you need by
<<<artifactId-version-classifier.jar>>> for the second one. The <<<artifactId>>> and <<<version>>>
will be replaced by the values given within the project's <<<pom.xml>>> file. The <<<classifier>>>
will be set to <<<tests>>> which is a default of the maven-jar-plugin and can be changed if needed by
{{{../test-jar-mojo.html}using the configuration in the jar goal}}.

<<Note:>> The downside of this solution is that you don't get the transitive <<<test>>>-scoped dependencies automatically.
Maven only resolves the <<<compile>>>-time dependencies, so you'll have to add all the other required <<<test>>>-scoped dependencies by hand.

* The preferred way

In order to let Maven resolve all <<<test>>>-scoped transitive dependencies you should create a separate project.
In order to let Maven resolve all <<<test>>>-scoped transitive dependencies, you should create a separate project.

+-----------------+
<project>
Expand Down
6 changes: 3 additions & 3 deletions src/site/apt/examples/manifest-customization.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ Manifest customization

* The Default Manifest

The default contents of the manifest is described in the documentation for
The default contents of the manifest are described in the documentation for
{{{/shared/maven-archiver/examples/manifest.html}Maven Archiver}}.

Starting with version 2.1, the maven-jar-plugin uses Maven Archiver ${mavenArchiverVersion}. This
means that it no longer creates the Specification and Implementation details
in the manifest by default. If you want them you have to say so explicitly in
your plugin configuration. This is also is described in the documentation for
your plugin configuration. This is also described in the documentation for
{{{/shared/maven-archiver/examples/manifest.html}Maven Archiver}}.

* Customization the Manifest
* Customizing the Manifest

The default manifest can be altered with the <<<archive>>> configuration
element. Below you will find some of the configuration options that are
Expand Down
6 changes: 3 additions & 3 deletions src/site/apt/index.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ ${project.name}

* Goals Overview

* {{{./jar-mojo.html}jar:jar}} create a jar file for your project classes inclusive resources.
* {{{./jar-mojo.html}jar:jar}} create a jar file for your project classes including resources.

* {{{./test-jar-mojo.html}jar:test-jar}} create a jar file for your project test classes .
* {{{./test-jar-mojo.html}jar:test-jar}} create a jar file for your project test classes.


* Usage
Expand All @@ -55,7 +55,7 @@ ${project.name}
entire debug logs, POMs, or most preferably little demo projects attached to the issue are very much appreciated.
Of course, patches are welcome, too. Contributors can check out the project from our
{{{./scm.html}source repository}} and will find supplementary information in the
{{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}.
{{{https://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}.

* Archiver Configuration

Expand Down
22 changes: 10 additions & 12 deletions src/site/apt/usage.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@

Usage

Some brief examples on how to use this plugin. If you want to use advanced
configurations you should have a look at the
Some brief examples of how to use this plugin. If you want to use advanced
configurations, you should have a look at the
{{{./index.html#Examples}Example section}}.
documentation for
{{{/shared/maven-archiver/}Maven Archiver}}.

To handle archiving this version of Maven JAR Plugin uses
To handle archiving, this version of the Maven JAR Plugin uses
Comment thread
elharo marked this conversation as resolved.
{{{/shared/maven-archiver/index.html}Maven Archiver}} ${mavenArchiverVersion}.

<<Note:>> If you need to sign your JAR files you should use the
<<Note:>> If you need to sign your JAR files, you should use the
{{{/plugins/maven-jarsigner-plugin/}Maven Jarsigner Plugin}} instead.

* How to build a JAR file
Expand All @@ -58,8 +56,8 @@ Usage
</project>
+----------+

Since 'jar' is the default packaging type it is not required to set it in this case.
Apart from the above you will normally want some real java source files which should be located within
Since 'jar' is the default packaging type, it is not required to set it in this case.
Apart from the above, you will normally want some real Java source files which should be located within
<<<src/main/java>>>. If you need extra resources on your classpath (for example property files)
they should be located in <<<src/main/resources>>>.
Now we can create a JAR-file by using the command below:
Expand All @@ -70,11 +68,11 @@ mvn package

The 'package' phase is always responsible for bundling all the files in the artifact, in this case a JAR-file.

In your project's <<<target>>> directory you'll see the generated jar file which is named like:
In your project's <<<target>>> directory, you'll see the generated jar file which is named like:
'core-1.0-SNAPSHOT.jar'. The resulting 'jar' file contains the compiled java class files as well as
the files from <<<src/main/resources>>>.

Usually there is no need to mentioned the 'maven-jar-plugin' explicit cause it's bound to
Usually there is no need to mention the 'maven-jar-plugin' explicitly because it's bound to
the {{{/guides/introduction/introduction-to-the-lifecycle.html}Maven Build Life Cycle}}.

For full documentation, click {{{./plugin-info.html}here}}.
Expand All @@ -85,7 +83,7 @@ mvn package
{{{https://cr.openjdk.java.net/~mr/jigsaw/spec/jar.html}changes in the JAR file specifications}}
as well - Modular JAR files. Modular JAR files are JAR files with <<<module-info.class>>> file in the root directory
(or in the versioned area for multi-release JAR files). If the project contains <<<module-info.class>>>
the resulting JAR will be a Modular JAR without a need for any configuration regardless of the plugin version used.
the resulting JAR will be a modular JAR without a need for any configuration regardless of the plugin version used.

Starting with version 3.1.2, if the JAR file contains <<<module-info.class>>>, this plugin will update
the modular descriptor (<<<module-info.class>>>) with additional attributes such as the list of packages included
Expand All @@ -95,5 +93,5 @@ mvn package
(for example how to set it read {{{../../shared/maven-archiver/examples/classpath.html}Make The Jar Executable}}).
Internally the plugin uses the JDK <<<jar>>> tool so in order to add the additional attributes and to
verify the modular descriptor Maven should be run with JDK version 9 or newer. If version 8 or earlier is used
the resulting JAR still will be Modular JAR (as it contains <<<module-info.class>>>) but no additional attributes
the resulting JAR will still be a modular JAR (as it contains <<<module-info.class>>>) but no additional attributes
will be added and no validation will be performed.
Loading