如何在全新安装中将多个jar文件发布到Maven [英] How to publish multiple jar files to maven on a clean install

查看:114
本文介绍了如何在全新安装中将多个jar文件发布到Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用过的maven程序集插件从一个jar中创建多个jar,现在的问题是我必须将这些jar发布到本地仓库中,就像其他maven jar在构建它们时自行发布一样.我将如何做到这一点

I have a used the maven assembly plugin to create multiple jar from one jar now the problem is that I have to publish these jar to the local repo, just like other maven jars publish by them self when they are built maven clean install how will I be able to do this

这是我的pom文件

<project>
 <parent>
  <groupId>parent.common.bundles</groupId>
  <version>1.0</version>
  <artifactId>child-bundle</artifactId>
 </parent>
 <modelVersion>4.0.0</modelVersion>
 <groupId>common.dataobject</groupId>
 <artifactId>common-dataobject</artifactId>
 <packaging>jar</packaging>
 <name>common-dataobject</name>
 <version>1.0</version>
 <dependencies>
      </dependencies>
 <build>
  <plugins>
   <plugin>
    <groupId>org.jibx</groupId>
    <artifactId>maven-jibx-plugin</artifactId>
    <version>1.2.1</version>
    <configuration>
     <directory>src/main/resources/jibx_mapping</directory>
     <includes>
      <includes>binding.xml</includes>
     </includes>
     <verbose>false</verbose>
    </configuration>
    <executions>
     <execution>
      <goals>
       <goal>bind</goal>
      </goals>
     </execution>
    </executions>
   </plugin>
   <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
     <execution>
      <id>make-business-assembly</id>
      <phase>package</phase>
      <goals>
       <goal>single</goal>
      </goals>
      <configuration>
       <appendAssemblyId>false</appendAssemblyId>
       <finalName>flight-dto</finalName>
       <descriptors>
        <descriptor>src/main/assembly/car-assembly.xml</descriptor>
       </descriptors>
       <attach>true</attach>
      </configuration>
     </execution>
     <execution>
      <id>make-gui-assembly</id>
      <phase>package</phase>
      <goals>
       <goal>single</goal>
      </goals>
      <configuration>
       <appendAssemblyId>false</appendAssemblyId>
       <finalName>app_gui</finalName>
       <descriptors>
        <descriptor>src/main/assembly/bike-assembly.xml</descriptor>
       </descriptors>
       <attach>true</attach>
      </configuration>
     </execution>
    </executions>
   </plugin>
  </plugins>
 </build>

  </project>

这是我的汇编文件

<assembly>
  <id>app_business</id>
  <formats>
    <format>jar</format>
  </formats>
  <baseDirectory>target</baseDirectory>
  <includeBaseDirectory>false</includeBaseDirectory>

  <fileSets>
    <fileSet>
      <directory>${project.build.outputDirectory}</directory>
      <outputDirectory></outputDirectory> 
      <includes>
        <include>com/dataobjects/**</include>
      </includes>
    </fileSet>    
  </fileSets>
</assembly>

推荐答案

非常感谢Pascal, 这也是我添加的配置,也可以正常使用..

Thanks a lot Pascal, This thing really works. Here is a the configuration that i have added too make it work..

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>abc</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>src/main/assembly/flight-assembly.xml</file>
                  <type>xml</type>
                  <classifier>flight</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
  </plugin>

这篇关于如何在全新安装中将多个jar文件发布到Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆