2014-01-06 53 views
1

我頭痛地嘗試安裝maven-as-plugin如何在重新部署前使用maven-as插件重新啓動JBoss

我的目標是在運行集成測試之前重新部署耳朵。 我希望此過程能夠自動將其集成到CI中。

服務器是遠程運行的JBoss服務器(AS 7)。

由於到JBoss的臭名昭著的PermGen的空間問題,我需要 之前重新啓動服務器部署的耳朵。否則,服務器將每隔5次左右爆炸...

爲此目的,我嘗試設置一個目標「shutdown」,其中reload = true。 問題在於Maven插件在運行下一個目標之前不會等待它完成(清除以前的工件)。

這裏是我的POM的摘錄:

 <!-- Jboss Deploy/undeploy application EAR --> 
     <plugin> 
     <groupId>org.jboss.as.plugins</groupId> 
     <artifactId>jboss-as-maven-plugin</artifactId> 
     <version>7.5.Final</version> 
     <configuration> 

      <!-- JBoss management --> 
      <hostname>${sanity.tests.jboss.host}</hostname> 
      <port>${sanity.tests.management.port}</port> 
      <username>${sanity.tests.jboss.username}</username> 
      <password>${sanity.tests.management.password}</password> 

     </configuration> 

     <executions> 

      <!-- Reload Jboss to avoid permgen space --> 
      <execution> 
      <id>restart</id> 
      <phase>pre-integration-test</phase> 
      <goals><goal>shutdown</goal></goals> 
      <configuration> 
       <reload>true</reload> 
      </configuration> 
      </execution> 

      <!-- Undeploy previous ear --> 
      <execution> 
      <id>undeploy</id> 
      <phase>pre-integration-test</phase> 
      <!-- Cleanup : Undeploy --> 
      <goals> 
       <goal>undeploy</goal> 
      </goals> 

      <configuration> 
      <matchPattern>rm-app.*.ear</matchPattern> 
       <ignoreMissingDeployment>true</ignoreMissingDeployment> 
      </configuration> 
      </execution> 

      <!-- Deploy before int test --> 
      <execution> 
      <id>deploy</id> 
      <phase>pre-integration-test</phase> 
      <goals> 
       <goal>deploy-artifact</goal> 
      </goals> 

      <configuration> 
       <name>xxxx</name> 
       <groupId>xxxxx</groupId> 
       <artifactId>xxxx</artifactId> 
       <version>${project.version}</version> 
      </configuration> 

      </execution> 
     </executions> 
     </plugin> 

任何幫助將非常感激。

+0

它比我切換到加載我的整個應用程序到一個嵌入式Jetty服務器是如此繁瑣和脆弱。 –

回答

0

嘗試先運行您的undeploy。如果這是AS上唯一的耳朵,那麼重新加載很可能足夠快,以便部署目標不會超時。

<goals> 
    <goal>undeploy</goal> 
    <goal>shutdown</goal> 
    <goal>deploy</goal> 
</goals> 

不幸的是,我不知道如何增加部署目標的超時。

0

我有完全相同的問題。 switangs建議(首先在重新啓動JBoss之前取消部署)肯定有幫助。我在服務器重新啓動和重新部署之間添加了一些時間的另一件事是將服務器的取消部署和重新啓動綁定到構建過程的一個非常早的步驟(例如初始化),而部署步驟綁定到過程資源或預先部署集成測試,就像你的情況一樣。這很有效,因爲我在一個單獨的集成測試模塊中部署我的構件,首先將所有與maven-dependency-plugin插件相關的服務器構件複製到$ {project.build.directory}/dependency文件夾作爲第一步。 但我同意這不是一個很好的解決方案,對獨立JBoss節點的阻塞重啓cli命令會好得多。

0

實際上,關機目標不會解決PermGen問題。 我使用cli解決了這個問題。

<plugin> 
    <groupId>org.jboss.as.plugins</groupId> 
    <artifactId>jboss-as-maven-plugin</artifactId> 
    <version>7.5.Final</version> 
    <configuration> 
     <afterDeployment> 
      <commands> 
       <command>/host=master:shutdown(restart=true)</command> 
      </commands> 
     </afterDeployment> 
    <!-- your configuration --> 
    ... 
    </configuration> 
<plugin> 

和「master」是域模式下主機的名稱。

相關問題