zoukankan      html  css  js  c++  java
  • Maven高级应用--编译全模块包-dist包

    1. 在需要生成dist包的模块级别,新建文件夹xxx-xxxx-dist

    2. 进入目录,新建pom.xml,建议copy

    3. dependencies节点,把要编译成全局包的应用引入进来

    <!-- 引入依赖模块 -->
    <dependency> <groupId>xxx.xxx.xxxx</groupId> <artifactId>xxx-xxx-core</artifactId> <version>${project.version}</version> </dependency>

    4. build节点设置文件名称

    <finalName>xxx-core</finalName>

    5. build->plugins节点新增如下插件

    插件一:生成dist包

    <!-- 生成xxx-core包 -->
    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-shade-plugin</artifactId>
       <version>1.4</version>
       <executions>
          <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <createSourcesJar>true</createSourcesJar>
                <promoteTransitiveDependencies>false</promoteTransitiveDependencies>
               <artifactSet>
                <includes>
                    <include>xxx.xxx.xxx:xxx-core-*</include>
                  </includes>
               </artifactSet>
           </configuration>
         </execution>
       </executions>
    </plugin>

    插件二:输出到指定目录

    <!-- 输出到上级目录 -->
      <plugin>
       <artifactId>maven-antrun-plugin</artifactId>
       <executions>
        <execution>
        <phase>package</phase>
        <goals>
         <goal>run</goal>
        </goals>
        <configuration>
         <tasks>
          <copy file="${project.build.directory}/xxx-core.jar" tofile="${project.basedir}/../xxx-core.jar" overwrite="true" />
          <copy file="${project.build.directory}/xxx-core-javadoc.jar" tofile="${project.basedir}/../xxx-core-javadoc.zip" overwrite="true" />
         </tasks>
        </configuration>
        </execution>
       </executions>
      </plugin>

    插件三:生成javadoc包

    <!-- 生成javadoc包 -->
      <plugin>
       <artifactId>maven-javadoc-plugin</artifactId>
       <version>3.0.1</version>
       <executions>
        <execution>
       <id>attach-javadoc</id>
       <goals>
         <goal>jar</goal>
       </goals>
       <configuration>
         <doclint>none</doclint>
       </configuration>
        </execution>
       </executions>
       <configuration>
        <includeDependencySources>true</includeDependencySources>
        <dependencySourceIncludes>
            <dependencySourceInclude>xxx.xxx.xxx:xxx-core-*</dependencySourceInclude>
        </dependencySourceIncludes>
        <show>public</show>
        <charset>UTF-8</charset>
        <encoding>UTF-8</encoding>
        <docencoding>UTF-8</docencoding>
        <links>
        <link>http://docs.oracle.com/javase/7/docs/api</link>
        </links>
        <tags>
        <tag>
         <name>@author</name>
         <placement>a</placement>
         <head>作者</head>
        </tag>
        <tag>
         <name>@email</name>
         <placement>a</placement>
         <head>作者邮箱</head>
        </tag>
        <tag>
         <name>@date</name>
         <placement>a</placement>
         <head>创建时间</head>
        </tag>
        </tags>
       </configuration>
    </plugin>
  • 相关阅读:
    iOS真机调试 for Xcode 5
    iOS/iphone开发如何为苹果开发者帐号APPID续费
    unity3d中布娃娃系统
    U3D实现与iOS交互
    两种方法连接MySql数据库
    Unity3D Gamecenter 得分上传失败的处理
    Unity3.5 GameCenter基础教程(转载)
    判断数字正则表达式
    (转)SQL server 2005查询数据库表的数量和表的数据量
    C#操作PowerDesigner代码
  • 原文地址:https://www.cnblogs.com/Toolo/p/10607117.html
Copyright © 2011-2022 走看看