我使用maven-3.0.4和maven-glassfish-plugin 2.1(http://maven-glassfish-plugin.java.net/)和Glassfish 2.1.1。Maven-glassfish-plugin:如何指定部署目標?
相關的pom.xml片段:
<profile>
<id>deploy</id>
<build>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>/home/user/glassfish</glassfishDirectory>
<domain>
<name>domain1</name>
<host>hostname</host>
<adminPort>4848</adminPort>
</domain>
<autoCreate>false</autoCreate>
<terse>true</terse>
<debug>false</debug>
<echo>true</echo>
<user>admin</user>
<passwordFile>/home/user/user.gfpass</passwordFile>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
</plugins>
</build>
</profile>
問題是,我部署到Glassfish的服務器每個開發人員一個獨立實例配置和運行mvn glassfish:deploy
原因:
[INFO] --- maven-glassfish-plugin:2.1:deploy (default-cli) @ project ---
[INFO] deploy --port 4848 --enabled=true --host hostanme --precompilejsp=false --verify=false --echo=true --upload=true --terse=true --generatermistubs=false --passwordfile /home/user/user.gfpass --interactive=false --availabilityenabled=false --name project --target server --force=true --user admin /home/user/git/project/target/project-1.0.0-SNAPSHOT.war
[ERROR] CLI171 Command deploy failed : Application project is already deployed on other targets. Please remove all references or specify all targets (if not using asadmin command line) before attempting redeploy operation
[ERROR] Deployment of /home/user/git/project/target/project-1.0.0-SNAPSHOT.war failed.
注意--target server
在執行的命令。
如何在POM中指定我要部署的實例(即target
)?