zoukankan      html  css  js  c++  java
  • Maven使用总结

    1、pom.xml文件中添加新的库

    在中央仓库找不到你想要的jar的时候,可以在pom.xml中添加附加的库,语法如下

        <repositories>
            <repository>
                <id>java.net</id>
                <url>https://repository.jboss.org/nexus/content/groups/public/</url>
            <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases> 
          <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots> 
        </repository>

    2、我们在maven install的时候,有些时候其实并不需要顺带执行test动作,这是后可以修改pom文件跳过test步骤

    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.13</version>
                    
                    <configuration>
                        <includes>
                            <include>**/*Tests.java</include>
                        </includes>
                        <skipTests>true</skipTests><!-- 自动跳过test -->
                    </configuration>
     </plugin>

    3、Failure to transfer xmlpull:xmlpull:jar:1.1.3.1 from https://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: Could not transfer artifact xmlpull:xmlpull:jar:1.1.3.1 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.

    出现类似这样的报错,但是maven install 有不管用,可知是本地仓库的缓存(cached)造成,到本地中央仓库的对应目录下把 xxx.lastUpdated文件全部删掉,重新运行maven即可。

    或者在用maven时加 -U参数,就可以忽略xxx.lastUpdated.

  • 相关阅读:
    UVa 10010 Where's Waldorf?
    boost 学习笔记
    C++ enum类型的一个更好的用法
    新浪面试题:删除字符串中多余的空格
    微软面试题:写程序找出二叉树的深度
    c++中sizeof的分析
    复习计划
    boost学习之 时间和日期 timer
    c++ template学习总结3
    微软面试题:反序一个单向链表
  • 原文地址:https://www.cnblogs.com/mingziday/p/4659487.html
Copyright © 2011-2022 走看看