Closed StevenOAG closed 8 years ago
That's how maven works in general. If the POM package type is ignored it could still potentially fail or deploy the incorrect archive as it would attempt to deploy the next part of the build.
The proper way to handle this is to define the plugin in your parent pom and use the <skip>true</skip>
configuration. Then define the plugin in the pom for the archive you want deployed and use <skip>false</skip>
in the configuration.
Unfortunately, that means adding this plugin declaration to every single child project which is about a dozen in my case. Also, this doesn't seem to fit how other maven plugins handle parent projects. Take the source plugin for example: you don't get a sources jar for the parent if you execute on that; you only get source jars for the child projects: http://svn.apache.org/viewvc/maven/plugins/tags/maven-source-plugin-2.4/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java?revision=1629962&view=markup
You'd only have to add the plugin to the parent pom and the pom of the child you want deployed.
Let's assume your project is an EAR deployment. You have a an EJB JAR and a WAR. The WAR likely depends on the EJB so the EJB would be built first. If we just ignore the parent pom in the plugin then the EJB would be deployed and not the final EAR.
The full reactor would be (in order) Parent EJB WAR EAR
In skipping the parent, you would deploy the EJB, WAR, and EAR which most people would only want the EAR and configure skip that way. I am not deploying any EARs and want to deploy all child projects but one. Either way, it fails the build on the first step (Parent) if you execute deploy on a pom project. I am thinking there should be some default behavior that doesn't crash the build. If you auto-skip POM projects, the default behavior would be to deploy all non-POM child projects. If the developer only wants a single project deployed (or a variation of this), they can add skip to the parent (which is inherited by all children) and override that in the EAR project. They already have to do that process anyway and this change won't affect that.
I've already got the change coded (Add a member to PackageType and a couple constructors for it), but I am trying to work through creating a test for it.
Cool. Creating a test for it might be a PITA. The testsuite for plugins isn't great. I wouldn't be too worried about it to be honest.
Just cleaning up old issues.
When executing 'deploy' on a parent pom (to deploy all the child projects), it fails. I looked at org.jboss.as.plugin.deployment.PackageType and it is hardcoded to not ignore any package types. The POM package type should be ignored by default since that project type does not generate a target directory.