2010-06-17 48 views
4

我需要將我的JavaEE應用程序部署在Glassfish上作爲目錄,而不是打包的WAR文件。 是否可以使用Maven Glassfish插件將目錄部署到Glassfish?Maven Glassfish插件:將應用程序部署爲分解目錄/文件夾

使用管理控制檯,這是可能的。但我希望能夠在命令行上做到這一點。

+0

你能確認你正在使用的插件? – 2010-06-17 13:11:07

+0

我正在使用maven-glassfish-plugin 2.1版 – ifischer 2010-06-17 13:35:46

回答

5

下面的配置對我的作品(注意artifact元素指向一個目錄):

<plugin> 
    <groupId>org.glassfish.maven.plugin</groupId> 
    <artifactId>maven-glassfish-plugin</artifactId> 
    <version>2.2-SNAPSHOT</version> 
    <configuration>       
    <glassfishDirectory>${glassfish.home}</glassfishDirectory> 
    <user>${domain.username}</user>     
    <passwordFile>${glassfish.home}/domains/${project.artifactId}/master-password</passwordFile>             
    <autoCreate>true</autoCreate> 
    <debug>true</debug>             
    <echo>true</echo> 
    <skip>${test.int.skip}</skip> 
    <domain> 
     <name>${project.artifactId}</name> 
     <httpPort>8080</httpPort> 
     <adminPort>4848</adminPort> 
    </domain>   
    <components> 
     <component>     
     <name>${project.artifactId}</name> 
     <artifact>${project.build.directory}/${project.build.finalName}</artifact> 
     </component> 
    </components>           
    </configuration> 
</plugin> 

產生的asadmin命令是:

 
asadmin --host localhost --port 4848 --user admin --passwordfile /home/pascal/opt 
/glassfishv3/glassfish/domains/maven-glassfish-testcase/master-password --interac 
tive=false --echo=true --terse=true deploy --name maven-glassfish-testcase --forc 
e=false --precompilejsp=false --verify=false --enabled=true --generatermistubs=fa 
lse --availabilityenabled=false --keepreposdir=false --keepfailedstubs=false --lo 
gReportedErrors=true --upload=false --help=false /home/pascal/Projects/stackoverf 
low/maven-glassfish-testcase/target/maven-glassfish-testcase 
+1

這麼簡單...我應該嘗試過。謝謝! 相應地更改了我的pom.xml。它的作品,現在我正在運行'mvn戰爭:爆炸玻璃魚:重新部署'。 – ifischer 2010-06-17 16:02:11

+0

@ifischer:不是嗎? :)其實,我專門爲你嘗試過。 – 2010-06-17 16:14:49

+1

Hey @Pascal_Thivent,其中迪迪發現了2.2-SNAPSHOT版本的maven-glassfish-plugin?它似乎無處可用。 – Riduidel 2011-08-03 13:54:39

1

我沒有得到它與Maven插件工作,但它可以部署使用asadmin命令從GlassFish/bin目錄中的命令行到Glassfish的:

的asadmin部署--contextroot context_root path_to_ear_or_directory

+0

那對我來說不是一種選擇,因爲我在Maven構建中將大量參數傳遞給Glassfish。無論如何,謝謝 – ifischer 2010-06-17 13:38:51

相關問題