On 19 November 2013 08:14, laredotornado-3 <[email protected]> wrote:
> Hi,
>
> I'm using Maven 3.0.3 and trying to use the Maven release plugin to do a
> release of a child module, which inherits from a parent pom. The parent has
> been released but does not include the child in its module list, and won't
> be able to in the short term. Is it possible to do a release of the child
> module? Right now, I'm getting the errors …
>
> mvn -B -DdevelopmentVersion=52.0.0-SNAPSHOT -DreleaseVersion=52.0.0
> -Dusername=laredotornado -Dtag=myproject-52.0.0 -DskipTests -P prod
> -Dresume=false -DdryRun=true release:prepare
> ...
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on
> project myproject: Can't release project due to non released dependencies :
> [ERROR] org.mainco.subco:core:jar:52.0.0-SNAPSHOT:compile
> [ERROR] org.mainco.subco:core:test-jar:tests:52.0.0-SNAPSHOT:test
> [ERROR] org.mainco.subco:database:jar:52.0.0-SNAPSHOT:compile
> [ERROR] org.mainco.subco:pd:jar:52.0.0-SNAPSHOT:compile
> [ERROR] org.mainco.subco:session:jar:52.0.0-SNAPSHOT:compile
> [ERROR] org.mainco.subco:subco:pom:52.0.0-SNAPSHOT
> [ERROR] in project 'myproject'
> (org.mainco.subco:myproject:war:52.0.0-SNAPSHOT)
> [ERROR] -> [Help 1]
Your child project depends on other unreleased artifacts, that is why
you are getting "Can't release project due to non released
dependencies"
You need to go back and release all these artifacts first before
attempting to release the child project that is not a module of the
parent.
> In my pom.xml file, I have the dependencies listed as such:
>
> <parent>
> <artifactId>subco</artifactId>
> <groupId>org.mainco.subco</groupId>
> <version>52.0.0-SNAPSHOT</version>
> </parent>
As others have said, you can't use a -SNAPSHOT for the parent when you
are releasing.
Since you have already released the parent set this to 52.0.0
> ...
> <dependency>
> <groupId>org.mainco.subco</groupId>
> <artifactId>core</artifactId>
> <version>${project.version}</version>
> </dependency>
The release:plugin first checks that all your dependencies are non snapshots.
This is before it goes and transforms the version for you to the releaseVersion.
This means that ${project.version} is still 52.0.0-SNAPSHOT and hence
all these error messages.
If you are releasing multiple artifacts at once by running at the
parent level, then I think the release:plugin will help you out by
transforming the currentVersion -> releaseVersion in the dependency
sections for things that are also in the reactor, i.e. modules of the
current invocation.
Since your project only has one artifact in the reactor - the war it
is not changing the other values for you.
If found that using ${project.version} can cause you pain, unless you
release everything at together.
The reason is due to an interpolated value, see
http://maven.apache.org/shared/maven-filtering/
Try running
mvn help:effective-pom
In the different modules as you release the parent by itself.
This is because the child's ${project.version} will be used to
interpolate the parent's depenencyManagement section *even though you
have released the parent*.
So the actual values are not baked into the released pom but can
change based on context.
For consumers of your artifacts this is not a problem. But when you
have the parent -> child relationship things can work weirdly.
Your options are:
* treat this like any other dependency and hard code it
* create a new property to hold the value and use that variable for
interpolation instead of ${project.version}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]