Maven使用总结
2024-09-13 00:09:33
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.
最新文章
- 2DToolkit官方文档中文版打地鼠教程(三):Sprite Collections 精灵集合
- mysql max_allowed_packet
- 基于 IdentityServer3 实现 OAuth 2.0 授权服务【密码模式(Resource Owner Password Credentials)】
- JS调用Delphi编写的OCX控件
- jQuery select 操作全集
- CSS自学笔记(11):CSS3背景和边框
- Android SwipeRefreshLayout
- Django小例子 – 模型数据的模板呈现
- CocoaPods 安装及使用
- vue 源代码创建tabs
- PE知识复习之PE合并节
- spark-RDD源码分析
- Linux内存管理 (3)内核内存的布局图
- Arrays类
- 椭圆曲线密码学ECC
- 12LaTeX学习系列之---LaTex的图片插入
- Vladik and Entertaining Flags CodeForces - 811E (并查集,线段树)
- Centos替换默认源
- MySQL的left on 【zt】
- Understanding Undefined Behavior