I run wsgen in its own profile because I don't want it to run every time I build the product. But I'm getting an error about a missing version when I run it:
$ mvn package -P wsgen [INFO] Scanning for projects... [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project project-ejb:2.3.15-SNAPSHOT (C:\Projects\MyProject\pom.xml) has 1 error [ERROR]
'build.plugins.plugin[org.jvnet.jax-ws-commons:jaxws-maven-plugin].dependencies.dependency.version' for org.glassfish:javax.javaee:jar is missing. @ line 167, column 41 [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
This is a snippet of the child pom (the pom with the profile):
<packaging>ejb</packaging>
<parent>
<artifactId>MyProject</artifactId>
<groupId>project</groupId>
<version>2.3.15-SNAPSHOT</version>
</parent>
<profiles>
<profile>
<id>wsgen</id>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.1</version>
<executions>
...
</executions>
<dependencies>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.javaee</artifactId>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
But, in the parent pom I'm defining this dependency with its version under the dependencyManagement
tag.
I think what's happening is the profile doesn't inherit the parent's dependencyManagement
tag so it thinks that the dependency is missing a version number. Is there a way to make the profile inherit this from the parent?
dependencyManagement
applies for dependencies
in the pom and child poms. It does not apply to dependencies
in plugins (at least, that's what i noticed in several plugins, like maven-dependency-plugin).
A possible solution is defining a property (javax.javaee.version
) in your parent pom and using it in your dependencyManagement
and in your jaxws-maven-plugin plugin.