标签:冲突 url set apach cst sources 环境 div 启动
下载安装包,maven官网
配置环境变量
MAVEN_HOME = D:\hnisi\local\apache-maven-3.0.4
PATH=%PATH%;%MAVEN_HOME%\bin
MAVEN_OPTS = -Xms128m -Xmx512m
M2_HOME = D:\hnisi\local\apache-maven-3.0.4
maven是最先声明原则来引用相应版本的jar,而gradle是最新版本原则。
首先要定位错误的jar包,在项目启动时加上vm参数-verbose:class,这时会打印类似如下信息:
[Loaded java.util.TaskQueue from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.TimerThread from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.Timer$1 from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded org.quartz.impl.StdScheduler from file:/Users/lilu/repository/org/quartz-scheduler/quartz/2.2.1/quartz-2.2.1.jar] [Loaded java.util.Hashtable$KeySet from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded org.quartz.SchedulerMetaData from file:/Users/lilu/repository/org/quartz-scheduler/quartz/2.2.1/quartz-2.2.1.jar] [Loaded java.util.TreeMap$NavigableSubMap from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.TreeMap$AscendingSubMap from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.TreeMap$NavigableSubMap$EntrySetView from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.TreeMap$AscendingSubMap$AscendingEntrySetView from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.TreeMap$NavigableSubMap$SubMapIterator from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.TreeMap$NavigableSubMap$SubMapEntryIterator from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded org.quartz.simpl.JobWrapper from file:/Users/lilu/repository/org/quartz-scheduler/quartz/2.2.1/quartz-2.2.1.jar] [Loaded org.quartz.simpl.TriggerWrapper from file:/Users/lilu/repository/org/quartz-scheduler/quartz/2.2.1/quartz-2.2.1.jar] [Loaded sun.util.locale.provider.TimeZoneNameUtility from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded sun.util.locale.provider.TimeZoneNameProviderImpl from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded sun.util.locale.provider.TimeZoneNameUtility$TimeZoneNameGetter from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded sun.util.resources.TimeZoneNamesBundle from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded sun.util.resources.TimeZoneNames from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded sun.util.resources.en.TimeZoneNames_en from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] [Loaded java.util.LinkedHashMap$LinkedKeySet from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar] group_1.testJob_1 运行在: Sun Apr 30 08:41:57 CST 2017 [Loaded org.quartz.DisallowConcurrentExecution from file:/Users/lilu/repository/org/quartz-scheduler/quartz/2.2.1/quartz-2.2.1.jar] [Loaded org.quartz.utils.ClassUtils f
maven的pom.xml会显示或隐式的依赖类包,如果不想依赖某个类包,可以通过用exclusion排除之,如下:
<dependency> <groupId>org.unitils</groupId> <artifactId>unitils-testng</artifactId> <version>${unitils.version}</version> <scope>test</scope> <exclusions> <exclusion> <artifactId>junit</artifactId> <groupId>junit</groupId> </exclusion> </exclusions> </dependency>
maven仓库主要有两种:
remote repository:相当于公共的仓库,大家都能访问到,一般可以用URL的形式访问
local repository:存放在本地磁盘的一个文件夹,例如,windows上默认是C:\Users\{用户名}\.m2\repository目录
repository里存放的都是各种jar包和maven插件。当向仓库请求插件或依赖的时候,会先检查local repository,如果local repository有则直接返回,否则会向remote repository请求,并缓存到local repository。也可以把做的东西放到本地仓库,仅供本地使用;或上传到远程仓库,供大家使用。
maven mirror:
mirror相当于一个拦截器,它会拦截maven对remote repository的相关请求,把请求里的remote repository地址,重定向到mirror里配置的地址。
通过以下图解:
没有配置mirror
配置mirror
此时,B Repository被称为A Repository的镜像。
如果仓库X可以提供仓库Y存储的所有内容,那么就可以认为X是Y的一个镜像。换句话说,任何一个可以从仓库Y获得的构件,都胡够从它的镜像中获取。
标签:冲突 url set apach cst sources 环境 div 启动
原文地址:http://www.cnblogs.com/liluredhat/p/6725202.html