Maven 报错处理
从svn拉项目时,如果一个项目有多个子工程,1). 直接从trunk下拉项目,例如wm6-jzmd-project-latest(荆州电子)、wm6-ttbeer-project(青啤),然后在eclipse里import-->Existing Maven Projects根据引导下一步直到完成;2). 然后右键上面两个项目名称下面的pom.xml(即一级工程下)Maven-->Update Project...就可以获取伺服上的jar资源库(如果还是没有成功下载到私服上的jar,一般都是maven的settings文件配置有问题)。----除了如下两个原因外,网速也是可能原因之一,尽量在网络空闲时间update项目。
1. pom.xml文件报:maven-enforcer-plugin is ignored by m2e 原因及处理办法:(pom.xml文件中execution报错处理)
It looks like that error is due to a missing <pluginManagement> tag. So, in order to avoid the exceptions in Eclipse, it looks like one needs to simply enclose all the plugin tags inside a <pluginManagement> tag, like so:
<build>
<pluginManagement>
<plugins>
<plugin> ... </plugin>
<plugin> ... </plugin>
....
</plugins>
</pluginManagement>
</build>
然后Maven右键-->Update Project...
2. 当编译maven项目不能下载伺服上jar时,可能是maven的setting.xml文件配置问题,例如如下,
repository中配置了两个id:Swisslog和Swisslog Repository,那么在servers中需要分别对应两个server及相应的id、username、password
<profiles>
<profile>
<id>Swisslog</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>Swisslog Repository</id>
<name>Swisslog Repository</name>
<url>https://repository.swissloq.com/nexus/content/qroups/public</url>
<!--<url>https://repository.swisslog.com/artifactory/swisslog-maven/</url>-->
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<!--<url>https://repository.swisslog.com/artifactory/swisslog-maven/</url> -->
</repository>
<repository>
<id>Swisslog</id>
<name>swisslog-maven</name>
<url>https://repository.swisslog.com/artifactory/swisslog-maven/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Swisslog</id>
<name>swisslog-maven</name>
<url>https://repository.swisslog.com/artifactory/swisslog-maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<servers>
<server>
<!--通过jfrog生成password-->
<id>Swisslog</id>
<username>e2mamic22k</username>
<password>AP3FeJJShDvm4SeH3MqyWAvAPRJRKF7UshBTvP</password>
</server>
<server>
<!--通过jfrog生成password-->
<id>Swisslog Repository</id>
<username>e2mamic22k</username>
<password>cmVmdGtuOjAxOjE3MTk2NTE1MDk6TThaSFVicm0wUmk4Z3dKbzJ6ZGp4T212MXda</password>
</server>
</servers>