如何在eclipse中查找maven的各个jar包依赖的是别的什么jar包
一直有个疑问就是,我在pom文件里面引用了那些配置信息,它是如何找到各自的依赖的,后来发现原来一些jar包的配置信息已经自己在开发的时候就写入了pom信息了,各自的依赖都在maven官方仓库里挂着,这个我们自己不用操心,那既然这样,我们又该从哪里查到这些依赖信息呢,这就需要用maven的命令了,如果你是在myeclipse或者eclipse中集成的maven开发环境,那么看到如下截图,你就明白了.
选择项目,邮件点击,选择run as > Run Configurations
下面是一些别的命令,如果想在myeclipse中运行,请去掉mvn三个单词~~
1、创建一个新的Maven项目:
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch3 -DartifactId=simple -DpackageName=org.sonatype.mavenbook
2、构建打包应用:
mvn install[在pom.xml同级目录下执行]
3、查看项目完整的pom.xml文件,包括系统默认设置以及用户自定义设置:
mvn help:effective-pom
4、生成报告或者文档:
mvn site
5、mvn exec:java执行目标类
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main
6、查看插件的完整描述:
mvn help:describe -Dplugin=exec -Dfull
7、找出该项目所依赖的项目(jar)列表:
mvn dependency:resolve
mvn dependency:analyze(找出项目非直接依赖)
结果如下:
[INFO] The following files have been resolved:
[INFO] com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] commons-collections:commons-collections:jar:3.1:compile
[INFO] commons-lang:commons-lang:jar:2.1:compile
[INFO] dom4j:dom4j:jar:1.6.1:compile
[INFO] jaxen:jaxen:jar:1.1.1:compile
[INFO] jdom:jdom:jar:1.0:compile
[INFO] junit:junit:jar:3.8.1:test
[INFO] log4j:log4j:jar:1.2.14:compile
[INFO] oro:oro:jar:2.0.8:compile
[INFO] velocity:velocity:jar:1.5:compile
[INFO] xalan:xalan:jar:2.6.0:compile
[INFO] xerces:xercesImpl:jar:2.6.2:compile
[INFO] xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] xom:xom:jar:1.0:compile
8、查看整个项目的依赖树:
mvn dependency:tree
结果如下:
[INFO] org.sonatype.mavenbook.ch04:simple-weather:jar:1.0
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- jaxen:jaxen:jar:1.1.1:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] | \- xom:xom:jar:1.0:compile
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | +- xalan:xalan:jar:2.6.0:compile
[INFO] | \- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] +- velocity:velocity:jar:1.5:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- commons-lang:commons-lang:jar:2.1:compile
[INFO] | \- oro:oro:jar:2.0.8:compile
[INFO] \- junit:junit:jar:3.8.1:test
9、查看完整的依赖,包括那些因为冲突而被拒绝引入的依赖:
mvn install -X
10、打包应用(jar):
mvn install assembly:assembly
11、在 Jetty Servlet 容器中启动你的 web 应用:
mvn jetty:run
12、重新编译:
mvn compile
下面是一些别的命令,如果想在myeclipse中运行,请去掉mvn三个单词~~
1、创建一个新的Maven项目:
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch3 -DartifactId=simple -DpackageName=org.sonatype.mavenbook
2、构建打包应用:
mvn install[在pom.xml同级目录下执行]
3、查看项目完整的pom.xml文件,包括系统默认设置以及用户自定义设置:
mvn help:effective-pom
4、生成报告或者文档:
mvn site
5、mvn exec:java执行目标类
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main
6、查看插件的完整描述:
mvn help:describe -Dplugin=exec -Dfull
7、找出该项目所依赖的项目(jar)列表:
mvn dependency:resolve
mvn dependency:analyze(找出项目非直接依赖)
结果如下:
[INFO] The following files have been resolved:
[INFO] com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] commons-collections:commons-collections:jar:3.1:compile
[INFO] commons-lang:commons-lang:jar:2.1:compile
[INFO] dom4j:dom4j:jar:1.6.1:compile
[INFO] jaxen:jaxen:jar:1.1.1:compile
[INFO] jdom:jdom:jar:1.0:compile
[INFO] junit:junit:jar:3.8.1:test
[INFO] log4j:log4j:jar:1.2.14:compile
[INFO] oro:oro:jar:2.0.8:compile
[INFO] velocity:velocity:jar:1.5:compile
[INFO] xalan:xalan:jar:2.6.0:compile
[INFO] xerces:xercesImpl:jar:2.6.2:compile
[INFO] xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] xom:xom:jar:1.0:compile
8、查看整个项目的依赖树:
mvn dependency:tree
结果如下:
[INFO] org.sonatype.mavenbook.ch04:simple-weather:jar:1.0
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- jaxen:jaxen:jar:1.1.1:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] | \- xom:xom:jar:1.0:compile
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | +- xalan:xalan:jar:2.6.0:compile
[INFO] | \- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] +- velocity:velocity:jar:1.5:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- commons-lang:commons-lang:jar:2.1:compile
[INFO] | \- oro:oro:jar:2.0.8:compile
[INFO] \- junit:junit:jar:3.8.1:test
9、查看完整的依赖,包括那些因为冲突而被拒绝引入的依赖:
mvn install -X
10、打包应用(jar):
mvn install assembly:assembly
11、在 Jetty Servlet 容器中启动你的 web 应用:
mvn jetty:run
12、重新编译:
mvn compile
更多推荐
所有评论(0)