1
我試圖找出是否可以使用maven從倉庫下載一個war artifact並開始使用jetty插件。從遠程倉庫下載一個Maven War artifact的碼頭
原因是我希望我的一個客戶自動使用我項目的最新版本,通過將我的CI服務器上傳到我的公司Maven回購上。
這可能嗎?如果是...如何?
我試圖找出是否可以使用maven從倉庫下載一個war artifact並開始使用jetty插件。從遠程倉庫下載一個Maven War artifact的碼頭
原因是我希望我的一個客戶自動使用我項目的最新版本,通過將我的CI服務器上傳到我的公司Maven回購上。
這可能嗎?如果是...如何?
我不知道這是否可能與碼頭插件,但它絕對有可能與貨物插件。
您可以配置貨物以下載您想運行的碼頭版本和戰爭文件。這是我用來部署到tomcat的配置,但它不應該和jetty所需的配置太差。我們甚至用這種方式在同一個tomcat中部署了幾場戰爭。
我所做的是首先下載war和tomcat(作爲依賴關係),然後使用依賴插件解壓war文件(這只是因爲我添加了一些配置文件),然後告訴貨物啓動web應用程序從我解壓戰爭的文件夾中找到。
<dependency>
<groupId>org.apache</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
<type>zip</type>
</dependency>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>unpack war and configuration</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>war-group-id</groupId>
<artifactId>war-artifact-id</artifactId>
<version>version</version>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/war
</outputDirectory>
</artifactItem>
</artifactItems>
<includes>**/*</includes>
</configuration>
</execution>
</executions>
</plugin>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<output>${project.build.directory}/logs/container.log</output>
<log>${project.build.directory}/logs/cargo.log</log>
<append>false</append>
<zipUrlInstaller>
<url>file:///${settings.localRepository}/org/apache/tomcat/${tomcat.version}/tomcat-${tomcat.version}.zip
</url>
</zipUrlInstaller>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<classpath>shared</classpath>
</dependency>
</dependencies>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/tomcat6x</home>
<deployables>
<deployable>
<location>${project.build.directory}/war</location>
<type>war</type>
<properties>
<context>/context</context>
</properties>
</deployable>
</deployables>
<properties>
<cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</pluginManagement>
是啊...關於該插件的最後一個forgott。我不得不承認,我甚至用它來進行自動集成測試部署。認爲這將很好地工作...感謝指針:-) – 2012-08-06 16:11:12