Maven FAQ Summary

Source: Internet
Author: User
Tags connection reset

1,

Failure to transfer org. Apache. Poi: poi-ooxml-schemas: jar: 3.10.1 from a http://repo.maven.apache.org/maven2 was cached in the local repository,
Resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: cocould not transfer artifact org. Apache. Poi: poi-ooxml-schemas: jar: 3.10.1 from/to central (http://repo.maven.apache.org/maven2 ):
Connection reset.

This is an exception in the local repository download interruption. just delete the local repository and download it again.

 

2,

Using Platform encoding (GBK actually) to copy filtered resources, I. e. Build is platform dependent!
Note:
If the project encoding is set to UTF-8, if Maven-resources-plugin uses the GBK encoding provided by windows, garbled characters will occur. After garbled characters, the compilation will fail.

Solution:
Set Plugin: Maven-resources-plugin under build-plugins in POM. XML to be consistent with the project code. For example, here is set to UTF-8

    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-resources-plugin</artifactId>                <version>2.6</version> <configuration> <encoding>UTF-8</encoding> </configuration>            </plugin>        </plugins>        <finalName>defalut_goal</finalName>        <defaultGoal>compile</defaultGoal>    </build>

 


3,
The Maven plug-in installed in eclipse is m2eclipse, and phase has been specified when the command line is used, but goal or phase is not specified when the [run as]-[Maven build] of m2eclipse is used
Specify the defaultgoal method in POM. xml:

    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-resources-plugin</artifactId>                <version>2.6</version>                <configuration>                    <encoding>UTF-8</encoding>                </configuration>            </plugin>        </plugins> <finalName>defalut_goal</finalName> <defaultGoal>compile</defaultGoal>    </build>

Compile

Specify in eclipse (this dialog box is displayed when Maven build is used for the first time ):



4,
Maven download source code and javadoc command

(1) download the source code and javadocs using Maven commands
When using Maven in IDE, if you want to view the source code and javadoc of the classes in the referenced jar package, you need to download these source codes using Maven commands before introducing them, the MVN command can easily achieve this goal:
MVN dependency: Sources
MVN dependency: resolve-dclassifier = javadoc
Command usage: first enter the corresponding Pom. xml directory, and then execute the preceding command:
The first command is to download the source code of the file that is dependent on POM. xml.
The second command is to download the corresponding javadocs
However, some files may not have source code or javadocs

(2) Add through configuration file
Open the maven configuration file setting. XML (.../. m2/settings. XML) and add the following Configuration:

<profiles><profile>    <id>downloadSources</id>    <properties>        <downloadSources>true</downloadSources>        <downloadJavadocs>true</downloadJavadocs>               </properties></profile></profiles><activeProfiles>  <activeProfile>downloadSources</activeProfile></activeProfiles>

(3) Configure eclipse
Window> preferences> Maven and checking the "Download artifact sources" and "Download artifact javadoc" Options



Http://blog.csdn.net/topwqp/article/details/8902863









 

Maven FAQ Summary

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.