maven依赖的jar包版本不一样_配置maven下载jar包源码文件、拷贝依赖jar到lib包、设置编译时jdk版本、根据不同环境采用不同配置...

1.调试工程的时候,有时候要追踪源码文件

使用maven命令:mvn dependency:sources下载依赖包的源代码。

或者

mvn dependency:sources -DdownloadSources=true -DdownloadJavadocs=true

或者

eclipse窗口->首选项->maven->勾选download artifact sources

还有一种应该也行:

org.apache.maven.plugins

maven-eclipse-plugin

2.9

true

true

网站原文

Artifacts with sources deployed can be attached to Eclipse libraries using downloadSources. Javadocs may be attached using downloadJavadocs The sources and javadocs of the librariesmust exist in the repository so that the plugin can download it and attach it.

2.编译打jar包时要把源码也打包增加如下配置

maven-source-plugin

2.1

true

compile

jar

3.列出jar包依赖关系

mvn dependency:tree > dep.log

4.解决资源文件编码问题

org.apache.maven.plugins

maven-resources-plugin

2.3

UTF-8

5.拷贝依赖的jar到lib目录下

org.apache.maven.plugins

maven-jar-plugin

true

lib/

com.test.MonitorMain

org.apache.maven.plugins

maven-dependency-plugin

copy

package

copy-dependencies

${project.build.directory}/lib

6.根据不同环境采用不同设置,通过实现,配置在外

develop

true

jdbc:oracle:thin:@127.0.0.1:1521:ORCL

product

jdbc:oracle:thin:@228.7.75.102:1521:ORCL

同时配置

org.apache.maven.plugins

maven-resources-plugin

2.3

UTF-8

src/main/resources

true

同时配置src/main/resources/db.properties

jdbc.url=${jdbc.url}

编译时制定参数:

测试环境直接 mvn clean package -Dmaven.test.skip=true   因为中设置默认采用测试环境配置

正式环境 mvn clean package -Dmaven.test.skip=true -Pproduct

7.mavn 制定编译器版本和字符编码

UTF-8

1.6

1.6

或者

        src/main/java                                                    org.apache.maven.plugins                 maven-compiler-plugin                                      lib                     1.6                     1.6                     UTF-8                                           

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值