Maven packaging generation Source kits and Javadoc package __java

Source: Internet
Author: User

When we develop a common module that deploy it to the MAVEN repository, it is best to provide both source and Javadoc packages so that users can go directly to the dependent source in the IDE to see the details of their implementation.

Because generating source packages and Javadoc packages are extremely common requirements, MAVEN officially provides plug-ins to help users complete this task
, CONFIGURED as follows:

<build> <plugins> <plugin> &LT;GROUPID&GT;ORG.APACHE.MAVEN.PLUGINS&LT;/GROUPID&G
            T <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> &L T;configuration> <source>${java.version}</source> <target>${java.vers Ion}</target> <testSource>${java.version}</testSource> <testtarget&gt ;${java.version}</testtarget> </configuration> </plugin> <!--configuration Build Javadoc Package --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifact Id>maven-javadoc-plugin</artifactid> <version>2.10.4</version> <configurat
            Ion> <encoding>UTF-8</encoding> <aggregate>true</aggregate>    <charset>UTF-8</charset> <docencoding>UTF-8</docencoding> </con figuration> <executions> <execution> <id>attach-javad
                    Ocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <!--matching Build Source Pack--> <plugin> <groupId>org.apache.maven.plugins</groupId> <ar Tifactid>maven-source-plugin</artifactid> <version>3.0.1</version> <execut Ions> <execution> <id>attach-sources</id> ;goals> <goal>jar</goal> </goals> </ex
            Ecution></executions> </plugin> </plugins> </build> 


In the process of using idea to generate Java doc, it may appear that the idea console output Chinese garbled, even if we specify the character set in the Maven-javadoc-plugin plug-in as UTF-8, is still garbled, because MAVEN's default platform encoding is GBK.

Solution:
In idea, open File | Settings | Build, Execution, Deployment | Build Tools | Maven | Runner add-DFILE.ENCODING=GBK to VM options, remember that it must be GBK. Reference

Maven Combat (ix)--Packaging tips: http://www.infoq.com/cn/news/2011/06/xxb-maven-9-package

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.