一直有个疑问就是,我在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

GitHub 加速计划 / ma / maven
27
0
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:4 个月前 )
ee8b8187 Bumps [net.bytebuddy:byte-buddy](https://github.com/raphw/byte-buddy) from 1.15.11 to 1.16.1. - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.15.11...byte-buddy-1.16.1) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- https://issues.apache.org/jira/browse/MNG-8529 1 天前
d7e5f75b Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.27.2 to 3.27.3. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.27.2...assertj-build-3.27.3) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- https://issues.apache.org/jira/browse/MNG-8528 1 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐