短版
我希望maven-glassfish-plugin只在根项目中在分层(基于继承的) maven多项目设置中执行。
长版本
以下设置:
project-root
|
+-pom.xml
|
+ ear-module
| |
| +-pom.xml
|
+ jar-module
|
+-pom.xml所有子模块都通过<modules>...</modules>包含在根项目中,所有子模块都继承根项目pom.xml。在我的根项目pom中,我包括maven-glassfish-plugin
...
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<inherited>false</inherited>
<configuration>
<glassfishDirectory>${glassfish.home}</glassfishDirectory>
<passwordFile>${glassfish.home}/masterpassword.txt</passwordFile>
<domain>
<name>${project.name}</name>
<adminPort>4848</adminPort>
<httpPort>8080</httpPort>
<httpsPort>8443</httpsPort>
<iiopPort>3700</iiopPort>
<jmsPort>7676</jmsPort>
</domain>
<components>
<component>
<name>poc.vermittler</name>
<artifact>${project.basedir}/ear-module/target/ear-project-1.0-SNAPSHOT.ear</artifact>
</component>
</configuration>
</plugin>
...(Note:这只是我pom的一个简化版本。它可能不会运行:)
我只想将ear-module模块部署到glassfish,这就是为什么我添加了<inherited>false</inherited>部分,并在根pom中将部署的模块描述为<components>...</components>。
现在命令:
mvn glassfish:deploy会把耳朵伸向玻璃鱼,到目前为止.但是,maven将递归地递归处理所有子模块,这些子模块都将失败:
No plugin found for prefix 'glassfish' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories我可以告诉maven只使用-pl选项运行根项目,但是为了我的兴趣,部署不应该依赖这样的附加信息。
非常感谢你的帮助!
发布于 2012-06-21 15:22:43
这个问题似乎没有很好的解决办法:
该插件支持“NOP”functionality
中失败
另一种方法可以是创建一个新的子项目( <modules>...</modules>不包括在根项目中,而是从根项目继承),并将依赖项添加到只有部署工件的项目。
这个插件现在可以包含在这个子项目中,而不需要运行任何子项目。
或者对于任何懒惰的人:mvn clean package glassfish:redeploy -pl .只选择性地运行根项目,而不降到子项目中。
https://stackoverflow.com/questions/11102781
复制相似问题