2011-01-19 108 views
10

有沒有辦法做到上安裝JAR-具有依賴性使用maven組件,插件創建的?MVN安裝JAR-與依賴性

+0

你是什麼意思'做一個jar -with-dependencies'? – 2011-01-19 11:40:12

+1

行家組裝-插件創建一個罐,它包括所有的依賴關係。我想用MVN安裝到此安裝到我的本地回購。 – 2011-01-19 13:58:16

+0

也許你可以發佈您的POM片斷 – Raghuram 2011-01-19 14:12:24

回答

-3

mvn install不這樣做呢?

0

一種方法是建立在您使用匯編插件的項目。在組裝插件配置,您可以指定你想要的輸出(JAR,ZIP,...)

在這個項目中的POM你可以把你的依賴並構建它。每次執行安裝命令所有的依賴將在您的打包文件。

0

看標題爲「執行:建立議會」下here

12

MVN裝配:裝配-DdescriptorId = JAR-與依賴性

:)

12

如果裝配綁定到包裝階段,它會在你的倉庫同時安裝了「常規」罐子和當你做一個構建時,依賴關係jar:

 <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <version>2.3</version> 
      <configuration> 
       <descriptorRefs> 
        <descriptorRef>jar-with-dependencies</descriptorRef> 
       </descriptorRefs> 
      </configuration> 
      <executions> 
       <execution> 
        <id>make-assembly</id> <!-- this is used for inheritance merges --> 
        <phase>package</phase> <!-- bind to the packaging phase --> 
        <goals> 
         <goal>single</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin>