尝试使用 Maven Cargo 插件而不是不支持热重新部署的 Maven GlassFish 插件。Cargo 在 GlassFish 本地现有安装的目标启动/运行上挂起,并占用高达 100% 的 CPU,直到我杀死它!我尝试使用纯文本密码,然后创建了一个密码文件,结果相同。在线搜索会出现各种 Cargo-GlassFish 配置的帖子,几乎所有的帖子都比我使用的版本旧,而且也没有帮助。附上 Maven 插件配置和调试日志。任何帮助表示赞赏。
Environment: Mac OS X Mavericks, Oracle JDK 1.7.0_45, GlassFish-4.0-b89, Maven 3.1.1, cargo-maven2-plugin 1.4.5
Maven 插件配置
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.5</version>
<configuration>
<container>
<containerId>glassfish4x</containerId>
<type>installed</type>
<output>${glassfish.installDirectory}/glassfish/domains/${glassfish.domainName}/logs/server.log</output>
<!-- Fail if not started/stopped within 30 sec -->
<timeout>30000</timeout>
</container>
<configuration>
<type>existing</type>
<home>${glassfish.installDirectory}/glassfish</home>
<properties>
<cargo.glassfish.domain.name>${glassfish.domainName}</cargo.glassfish.domain.name>
<cargo.remote.username>${glassfish.adminUser}</cargo.remote.username>
<cargo.remote.passwordFile>${glassfish.installDirectory}/admin.password</cargo.remote.passwordFile>
<!-- Maven sets java.home property to JRE but we want JDK -->
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>${project.packaging}</type>
<properties>
<context>/${project.artifactId}</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
调试日志
[DEBUG] [2.ContainerStartMojo] Resolved artifact and dependencies:file:/Users/Abhijit/Repositories/maven/org/codehaus/cargo/cargo-core-container-glassfish/1.4.5/cargo-core-container-glassfish-1.4.5.jar]
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.5 for container glassfish4x
[DEBUG] Scheduling deployable for deployment: [groupId [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId [calculator-enc], type [war], location [null], pingURL [null]]
[DEBUG] Initial deployable values: groupId = [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId = [calculator-enc], type = [war], location = [null]
[DEBUG] Searching for an artifact that matches [name.abhijitsarkar.learning.webservices.jaxws.security:calculator-enc:war:null]...
[DEBUG] Checking artifact [name.abhijitsarkar.learning.webservices.jaxws.security:calculator-enc:war:null]...
[DEBUG] Computed deployable values: groupId = [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId = [calculator-enc], classifier = [null], type = [war], location = [/Users/Abhijit/Repositories/git/java-ee/jaxws-security/calculator-enc/target/calculator-enc-0.0.1-SNAPSHOT.war]
[DEBUG] Setting deployable property [context]:[/calculator-enc] for [/Users/Abhijit/Repositories/git/java-ee/jaxws-security/calculator-enc/target/calculator-enc-0.0.1-SNAPSHOT.war]
[DEBUG] Invoking setter method public synchronized void org.codehaus.cargo.container.deployable.WAR.setContext(java.lang.String) for deployable org.codehaus.cargo.container.deployable.WAR[calculator-enc-0.0.1-SNAPSHOT.war] with argument /calculator-enc
[DEBUG] Setting container timeout to [30000]