业务开发(八)—— Maven

0x01、maven install成功后,项目旁边依然有个红叉

maven——update——选中下方Force Update of Snapsshots/Releases

0x02、An internal error occurred during: “Updating Maven Project”. java.lang.NullPointerException

删除项目下的.setttings文件夹和.project文件,然后重新导入项目

0x03、在IDEA中pom配置的依赖包无法显示

点击——Maven Projects——刷新按钮,即可显示出来。

0x04、修改maven的中心仓库

找到settings.xml,在mirrors标签中加入下列代码

    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>       
    </mirror>

完整settings.xml文件

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<pluginGroups>

</pluginGroups>

<proxies>

</proxies>

<servers>

</servers>

<mirrors>

<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>
http://maven.aliyun.com/nexus/content/groups/public/
</url>
<mirrorOf>central</mirrorOf>
</mirror>

</mirrors>

<profiles>


</profiles>

</settings>

0x05、修改maven的中心仓库

Tomcat报错

SEVERE: ContainerBase.addChild: start:org.apache.catalina.LifecycleException: Failed to start error
Lorg/apache/commons/logging/Log; 类找不到

解决方法;
在IDEA中找ctrl+shift+alt+S,找到maven的library中的对应的类。
其中library都会扫描本地的.m2的项目,而同一个类有几个版本,它只会选择其中一个版本。
在maven-metadata-centra中配置

<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
  <groupId>commons-logging</groupId>
  <artifactId>commons-logging</artifactId>
  <versioning>
    <latest>1.2</latest>
    <release>1.2</release>
    <versions>
      <version>1.0</version>
      <version>1.0.1</version>
      <version>1.0.2</version>
      <version>1.0.3</version>
      <version>1.0.4</version>
      <version>1.1</version>
      <version>1.1.1</version>
      <version>1.1.2</version>
      <version>1.1.3</version>
      <version>1.2</version>
    </versions>
    <lastUpdated>20140709195742</lastUpdated>
  </versioning>
</metadata>

修改lastest中的版本号,要确定该版本号是可用的

posted @ 2016-11-11 10:19  清泉白石  阅读(366)  评论(0)    收藏  举报