Excessive class problems occur during Maven packaging.

Source: Internet
Author: User


Problem description:
When MVN clean install is used, some classes that are not in the source code will be added to the package.
<Ignore_js_op>

Mvn1.jpg (56.52 kb, downloads: 31)

Download the attachment and save it to the album.

Upload

 




Java. annotation classes are added to the jar package.

I don't know how these classes are compiled. These files are available in the classes directory during compilation.

Solution:

Add the following to the POM file:

<Build>
<Plugins>

<Plugin>
<Groupid> org. Apache. Maven. plugins </groupid>
<Artifactid> Maven-jar-plugin </artifactid>
<Version> 2.4 </version>
<Configuration>
<Excludes>
<Exclude> javax/** </exclude>
</Excludes>
</Configuration>
</Plugin>

</Plugins>
</Build>


Eliminate unnecessary files during the jar package. This also helps us eliminate unnecessary files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.