Are there any examples of using maven-jar-plugin?

I am very new to Maven and would like to see an example of how one uses the maven jar plugin. I already visited here , but did not find any examples. Some parameters for this purpose were indicated on the documentation page, but what I was looking for was how they fit into the "target" or "execution" tag. Thank.

+3
source share
2 answers

Usually you do not use the jar plugin. If you set the packaging to jar, the target banner: jar will be executed automatically.

If you want to configure the jar plugin do the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3.1</version>
    <configuration>
        <excludes>
            <exclude>**/*.xml</exclude>
        </excludes>
    </configuration>
</plugin>

(Example: exclude all XML files from the flag)

- , .

:

+5

Maven , maven jar. , .

maven Usage, Maven JAR. , seanizer, Maven JAR Plugin , , Maven .

Maven (, compile, test, package ..) Lifecycle ( ), . phase (, package), Maven .

, packaging jar , package, jar:jar, Maven JAR. packaging war war:war package, Maven WAR package. .

, (jar, war, ear ..) . "" : compile , test , package ..

, , , - , "" "".

Maven, <configuration>. <configuration> (), <execution> , , , , ( ).

Maven JAR Plugin, <configuration> , , <execution> ( ).

+5

Source: https://habr.com/ru/post/1772121/


All Articles