2016-12-06 27 views
0
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>SoclePDCFDR</groupId> 
    <artifactId>SoclePDCFDR</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 



    <dependency> 
     <groupId>ojdbc</groupId> 
     <artifactId>ojdbc</artifactId> 
     <version>14</version> 
     <type>pom</type> 
    </dependency> 


<build> 

    <!-- <sourceDirectory>src</sourceDirectory> 
    <resources> 
     <resource> 
      <directory>src</directory> 
      <excludes> 
       <exclude>**/*.java</exclude> 
      </excludes> 
     </resource> 
    </resources> --> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-shade-plugin</artifactId> 
      <version>2.4.3</version> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>shade</goal> 
        </goals> 
        <configuration> 
         <finalName>Test</finalName> 
         <shadedArtifactAttached>true</shadedArtifactAttached> 
         <shadedClassifierName>jar-with-dependencies</shadedClassifierName> 
         <transformers> 
          <transformer 
           implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
           <manifestEntries> 
            <Main-Class>com.sfdr.ms.pdc.FilesManagementMain</Main-Class> 
           <Class-Path>.</Class-Path> 
           </manifestEntries> 
          </transformer> 
         </transformers> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

如何使用,而不是兩個

回答

0

行家陰影插件,請利用以下插件作爲參考與它裏面的所有的依賴只能創建一個可執行的JAR,

<plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <descriptorRefs> 
         <descriptorRef>jar-with-dependencies</descriptorRef> 
        </descriptorRefs> 
        <archive> 
         <manifest> 
          <mainClass>com.bitsWilp.BITSPilani</mainClass> 
         </manifest> 
        </archive> 
        <finalName>bitsWILP</finalName> 
        <appendAssemblyId>false</appendAssemblyId> 
       </configuration> 
</plugin> 

編號:https://github.com/ramasamykasiviswanathan/BITSWilpAPI/blob/newAPIimpl/pom.xml

我編寫了一個API,它具有所有依賴關係。

+0

對我來說,它仍然創建兩個罐子, \t 4.0.0 \t SoclePDCFDR \t SoclePDCFDR \t 0.0.1-SNAPSHOT我與名稱SoclePDCFDR-0.0 .--快照將此添加在pom.xml的頂部的兩個罐和最後名字的那個 – user2025528

+0

你能分享我的完整內容,你在哪裏打包,理想情況下它應該工作。 –

+0

嘿,剛剛檢查我的構建與最終名稱是什麼有依賴打包到它。 –

相關問題