`
liuzongan
  • 浏览: 92141 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

maven使用自己资料

阅读更多

maven.apache.org/guides/getting-started/index.html#What_is_Maven

新建JAVA普通项目:

mvn archetype:create \
  -DarchetypeGroupId=org.apache.maven.archetypes \
  -DgroupId=com.mycompany.app \
  -DartifactId=my-app

新建WTP web项目:

mvn archetype:create \
    -DarchetypeGroupId=org.apache.maven.archetypes \
    -DarchetypeArtifactId=maven-archetype-webapp \
    -DgroupId=com.mycompany.app \
    -DartifactId=my-webapp

下面是对pom.xml文件里面的标签进行讲解:

  • project This is the top-level element in all Maven pom.xml files.
  • modelVersion This element indicates what version of the object model this POM is using. The version of the model itself changes very infrequently but it is mandatory in order to ensure stability of use if and when the Maven developers deem it necessary to change the model.
  • groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org.apache.maven.plugins is the designated groupId for all Maven plug-ins.
  • artifactId This element indicates the unique base name of the primary artifact being generated by this project. The primary artifact for a project is typically a JAR file. Secondary artifacts like source bundles also use the artifactId as part of their final name. A typical artifact produced by Maven would have the form <artifactid></artifactid>-<version></version>.<extension></extension> (for example, myapp-1.0.jar ).
  • packaging This element indicates the package type to be used by this artifact (e.g. JAR, WAR, EAR, etc.). This not only means if the artifact produced is JAR, WAR, or EAR but can also indicate a specific lifecycle to use as part of the build process. (The lifecycle is a topic we will deal with further on in the guide. For now, just keep in mind that the indicated packaging of a project can play a part in customizing the build lifecycle.) The default value for the packaging element is JAR so you do not have to specify this for most projects.
  • version This element indicates the version of the artifact generated by the project. Maven goes a long way to help you with version management and you will often see the SNAPSHOT designator in a version, which indicates that a project is in a state of development. We will discuss the use of snapshots and how they work further on in this guide.
  • name This element indicates the display name used for the project. This is often used in Maven's generated documentation.
  • url This element indicates where the project's site can be found. This is often used in Maven's generated documentation.
  • description This element provides a basic description of your project. This is often used in Maven's generated documentation.

    以下maven自已的命令格式:
    mvn compile

    mvn test

    mvn test-compile ( simply want to compile your test sources )

    mvn clean test-compile

    mvn install

    mvn clean install

    mvn clean  

  • mvn  install(可将你的项目打包成jar文件放到你的.m2/repo下面了)

     mvn package

  • mvn site

  • mvn resources:resources

  • mvn idea:idea

    mvn eclipse:eclipse  

    mvn eclipse:clean

    mvn process-resources

    mvn process-resources "-Dcommand.line.prop=hello again"
    

    # application.properties
    java.version=${java.version}
    command.line.prop=${command.line.prop}

  • # application.properties
    application.name=${pom.name}
    application.version=${pom.version}
      

    <build></build>
      <build></build>
        <resources></resources>
          <resource></resource>
            <directory></directory>src/main/resources
            <filtering></filtering>true
         
       
     


        
  • mvn deploy
    java 代码
    xml 代码
    1. [...]   
    2. <distributionManagement>  
    3. <repository>  
    4. <id>proficio-repositoryid>  
    5. <name>Proficio Repositoryname>  
    6. <url>file://${basedir}/target/deployurl>  
    7. repository>  
    8. distributionManagement>  
    9. [...]  


     指定编译后目录:

    xml 代码
    1. <build>  
    2.   <directory>${basedir}/targetdirectory>     
    3. build>  

     

  • For this example, we will configure the Java compiler to allow JDK 5.0 sources. This is as simple as adding this to your POM:

    ...
    <build></build>
      <plugins></plugins>
        <plugin></plugin>
          <groupid></groupid>org.apache.maven.plugins
          <artifactid></artifactid>maven-compiler-plugin
          <configuration></configuration>
            <source></source>1.5
            <target></target>1.5
         
       
     

    ...

    dependencies

    dependency这行依赖

  • http://www.devzuz.com/web/guest/downloads

  • 分享到:
    评论

    相关推荐

      maven学习相关资料

      该资料主要讲maven的基础用法,安装和使用等。还有maven常常被使用到的一些命令和用法。注意事项等。

      maven教案-maven入门学习资料

      maven教案,maven学习资料,maven入门

      maven中文学习资料

      maven中文学习,maven-definitive-guide_zh.pdf

      maven相关资料

      开发团队可以自动完成项目的基础工具建设,Maven使用标准的目录结构和默认构建生命周期。 在多个开发团队环境时,Maven可以设置按标准在非常短的时间里完成配置工作。由于大部分项目的设置都很简单,并且可重复使用...

      关于maven的资料关于maven的资料

      关于maven的资料关于maven的资料关于maven的资料关于maven的资料

      Maven教程资料.pdf

      Maven教程资料.pdf

      maven学习视频资料和自己心得

      里面有一套详细的2018maven最新视频和资料,同时也附带其他技术的分享渠道,里面有我自己对学习maven和软件开发技术的心得体会。

      maven 配置与使用

      包含了&lt;&lt;maven权威指南&gt;&gt;,maven官方api使用等,自己的maven笔记等详细的maven使用教程,同时还包含了maven客户端搭建,服务器配置于搭建的详细资料,是以整套的maven学习资料.

      Maven2_资料分享

      包含:Maven2_基础教程.pdf\《Maven权威指南》-电子书下载(PDF)(中文)\maven2完全使用手册.docx\Maven3实战笔记04Maven的生命周期和插件.doc\Maven实战.pdf\Maven学习指南.pdf

      自己做的一个maven的ppt资料

      自己做的一个关于maven介绍的ppt 总体介绍了一下maven 想迅速了解maven 的可以看看

      Maven资料大合集

      8本书,完全可以让你掌握Maven的全过程, 中英文都有,绝对物有所值。 经济实惠,呵呵

    Global site tag (gtag.js) - Google Analytics