maven-embedded-glassfish-plugin 部署 2 个应用程序
我有以下用例: 我正在使用 Spring MVC 实现一个 Web 应用程序,并使用 Spring WS 实现的 Web 服务。
这些项目使用 Maven 作为构建工具。 现在我想对网络应用程序实施集成测试。 为此,我想使用 maven-embedded-glassfish-plugin。 我在 pom.xml 中有以下 Maven 配置:
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<goalPrefix>embedded-glassfish</goalPrefix>
<app>${basedir}/target/web-app.war</app>
<autoDelete>true</autoDelete>
<port>8080</port>
<name>web-app</name>
<configFile>src/test/resources/glassfish/domain.xml</configFile>
</configuration>
<executions>
<execution>
<id>start-glassfish</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>glassfish-deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>glassfish-undeploy</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
</goals>
</execution>
<execution>
<id>stop-glassfish</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
一切正常。 但现在我需要添加webservice.war文件的部署。 此时这不是我的 pom 的依赖项。 我只有一个存根类用于调用 web-app.war 应用程序中定义的 Web 服务。
那么如何部署第二个应用程序有什么好的解决方案吗?
我希望能够自动实现某些功能,也许可以使用 Maven 存储库,因为如果我进行修改,我想自动使用新版本的 Web 服务。
I have the following use-case:
I am having a web-application implemented with Spring MVC using a Web service implemented with Spring WS.
The projects are using maven as build tool.
Now I want to implement integration test for the web-application.
For this I want to use the maven-embedded-glassfish-plugin.
I have the following maven configuration in pom.xml:
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<goalPrefix>embedded-glassfish</goalPrefix>
<app>${basedir}/target/web-app.war</app>
<autoDelete>true</autoDelete>
<port>8080</port>
<name>web-app</name>
<configFile>src/test/resources/glassfish/domain.xml</configFile>
</configuration>
<executions>
<execution>
<id>start-glassfish</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>glassfish-deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>glassfish-undeploy</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
</goals>
</execution>
<execution>
<id>stop-glassfish</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
Everything works fine.
But now I need to add the deployment of the webservice.war file.
This is not a dependency of my pom in this moment.
I am having only a stub class for calling the web service defined in the web-app.war application.
So any good solution how to deploy this second application ?
I would like to be something automatically, maybe using the maven repository for it, cause if I make a modification I want to use automatically the new version of the web-service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 [email protected] 和 Bhavani Shankar 先生提供以下解决方案:
理论上,您可以在战争的 Maven 中设置依赖项然后也从 lib 目录部署 war 文件。
如果有人想使用这个选项,这个插件有一些有趣的地方:
仅在现有 glassfish 安装的情况下无法在版本 3.1.1 中工作。
如果您想设置此属性,请使用(无需安装 glassfish):
I find out with the help of [email protected] and Mister Bhavani Shankar the following solution:
Teoretically you can set the dependency in maven of the war and then deploy the war file from the lib directory too.
Something interesting about this plugin, if somebody want to use the option :
Is not working in the version 3.1.1 only with an existing glassfish installation.
If you want to set this property then use (without having an installation of glassfish):
对于 3.1.1 版本的 maven-embedded-glassfish-plugin,您只需将“glassfish.embedded.tmpdir”属性设置为静态值(对于 Windows 操作系统,但我不是当然对于 Linux)。因为maven无法转换路径。
我正在给玻璃鱼部署一只耳朵,它对我来说非常有效。
我的配置是:
但是如果我删除glassfish.embedded.tmpdir=target/glassfish
部分然后启动服务器,它会慢慢加载项目, 这真的很有趣而且它并不稳定。
For 3.1.1 version of the maven-embedded-glassfish-plugin, you just need to set the "glassfish.embedded.tmpdir" property to a static value (for windows os, but I'm not sure for linux). Because maven can't convert the paths.
I'm deploying an ear to glassfish and it perfectly working for me.
My configuration is:
But it is really interesting if I remove the
<property>glassfish.embedded.tmpdir=target/glassfish</property>
part and then start the server, it is loading the project slowly and it is not stable.