1. Install m2Eclipse
要使用下面这个link.
http://download.eclipse.org/technology/m2e/releases
apache-maven-3.2.3\lib\maven-model-builder-3.2.3.jar\org\apache\maven\model\pom-4.0.0.xml
<repositories> <repository> <id>central</id> <name>Central Repository</name> <url>https://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <name>Central Repository</name> <url>https://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> <releases> <updatePolicy>never</updatePolicy> </releases> </pluginRepository> </pluginRepositories>
2. Maven 需要使用JDK,不能使用JRE.
3. setting.xml 中 server 元素的 id 必须与 POM 中需要谁的 repository 元素的 id 完全一致。正是此 id 将认证信息与仓库配置联系在一起。
settings.xml <servers> <server> <id>central</id> <username>repouser</username> <password>repopwd</password> </server> </servers> pom-4.0.0 <project> <modelVersion>4.0.0</modelVersion> <repositories> <repository> <id>central</id> <name>Central Repository</name> <url>https://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </project>
4. Change version from 2.3.2 to 3.1, then problem sloved.
DescriptionResourcePathLocationType
Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from https://hostname:8081/nexus/service/local/repositories/mavencentral/content was cached in the local repository, resolution will not be reattempted until the update interval of dsnexus-central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to dsnexus-central (https://hostname:8081/nexus/service/local/repositories/mavencentral/content): Access denied to https://hostname:8081/nexus/service/local/repositories/mavencentral/content/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom. Error code 401, Unauthorizedpom.xml/MavenTest2line 1Maven Configuration Problem
<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <executions> <execution> <id>default-compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </execution> <execution> <id>default-testCompile</id> <phase>test-compile</phase> <goals> <goal>testCompile</goal> </goals> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </execution> </executions> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin>