Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing a multi-module project w/ aar submodules, requires -DignoreSnapshots=true #529

Closed
MartinMReed opened this issue Dec 5, 2014 · 12 comments

Comments

@MartinMReed
Copy link
Contributor

When performing the release of a multi-module project that has aar submodules, using -DignoreSnapshots=true is required when it should not be.

mvn clean release:prepare release:perform --batch-mode -DdryRun=true

If you run the above, in the log when it executes release:prepare and it says it is checking the versions, it prints this in the error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project android-core: Can't release project due to non released dependencies :
[ERROR] com.my.company:my-app-android_extracted:jar:1.0.0-SNAPSHOT:system

The correct full name should be com.my.company:my-app-android:aar:1.0.0-SNAPSHOT
The artifact and packaging changed to the _extracted:jar.

The release plugin is only supposed to care about external dependencies:
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.maven.release/maven-release-manager/2.5/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java#311

315        // We are only looking at dependencies external to the project - ignore anything found in the reactor as
316        // it's version will be updated

So when its validating the versions it should ignore submodules because they are part of the reactor. But its finding the _extracted:jar, so it fails. The workaround is to add -DignoreSnapshots=true, however this should not be required.

android-maven-plugin version 4.0.0
maven-release-plugin version 2.3.2, 2.5.1

@rtack
Copy link

rtack commented Dec 5, 2014

that seems to be maven-release-plugin related and afaict has nothing to do with the android maven plugin.

@MartinMReed
Copy link
Contributor Author

This was not an issue when using apklib, before switching to aar.

Quick search brought up this:

private void addClassesToClasspath( UnpackedLibHelper helper, MavenProject project, Artifact artifact )

final Dependency dependency = createSystemScopeDependency( artifact, classesJar, "extracted" );
project.getModel().addDependency( dependency );

@william-ferguson-au
Copy link
Contributor

apklib was a much simpler format than aar. It could not contain inner
artifacts.
What is the output if you execute 'maven release:prepare'?

On Fri, Dec 5, 2014 at 6:32 PM, Martin M Reed [email protected]
wrote:

This was not an issue when using apklib, before switching to aar.


Reply to this email directly or view it on GitHub
#529 (comment)
.

@JBirdVegas
Copy link

I think Martin is correct here. When the release plugin checks if the dependency is part of the reactor then the suffix "extracted" will make the parent's artifactId not match the dependency's artifactId causing the release:prepare goal to fail.

Please review this pull request to address the issue: #530

It should be noted that anything added to the artifactId will cause the release plugin to fail so I'm not sure the usecase for appending a suffix.

@MartinMReed
Copy link
Contributor Author

@william-ferguson-au,
This is the behavior of release:prepare:

Preparing a release goes through the following release phases:
• Check that there are no uncommitted changes in the sources
• Check that there are no SNAPSHOT dependencies
• Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
• Transform the SCM information in the POM to include the final destination of the tag
• Run the project tests against the modified POMs to confirm everything is in working order
• Commit the modified POMs
• Tag the code in the SCM with a version name (this will be prompted for)
• Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
• Commit the modified POMs

https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html

@MartinMReed
Copy link
Contributor Author

Here is a way to test this. Run the following on your aar-child test project.

mvn clean release:prepare release:perform --batch-mode -DdryRun=true -DremoteTagging=false -Dmaven.android.plugin.version=4.0.0

The result:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project aar-child-project: Can't release project due to non released dependencies :
[ERROR] org.jboss.aerogear:aar-child-library_extracted:jar:2.0.0-SNAPSHOT:system

@william-ferguson-au
Copy link
Contributor

Martin I understand the behaviour of release:prepare
I would like to know the output of executing 'mvn release:prepare' on your
project.

On Sat, Dec 6, 2014 at 5:21 AM, Martin M Reed [email protected]
wrote:

@william-ferguson-au https://github.com/william-ferguson-au,
This is the behavior of release:prepare:

Preparing a release goes through the following release phases:
• Check that there are no uncommitted changes in the sources
• Check that there are no SNAPSHOT dependencies
• Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
• Transform the SCM information in the POM to include the final destination of the tag
• Run the project tests against the modified POMs to confirm everything is in working order
• Commit the modified POMs
• Tag the code in the SCM with a version name (this will be prompted for)
• Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
• Commit the modified POMs

https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html


Reply to this email directly or view it on GitHub
#529 (comment)
.

@MartinMReed
Copy link
Contributor Author

@william-ferguson-au,
Please be more specific about what type of output you are looking for. I've already pasted the log output. You can see by the listed behavior that there is not expected to be any binary output created either (that happens during release:perform).

With this error it never gets to the state where the target directory is even created, so there is zero file output.

@william-ferguson-au
Copy link
Contributor

I am looking for the log output of 'mvn release:prepare' not 'mvn clean
release:prepare release:perform --batch-mode -DdryRun=true'

On Sat, Dec 6, 2014 at 5:56 AM, Martin M Reed [email protected]
wrote:

Please be more specific about what type of output you are looking for.
I've already pasted the log output. You can see by the listed behavior that
there is not expected to be any binary output created either.

With this error it never gets to the state where the target directory is
even created, so there is zero file output.


Reply to this email directly or view it on GitHub
#529 (comment)
.

@MartinMReed
Copy link
Contributor Author

@william-ferguson-au,
It launches into interactive mode, which is not the use-case. The --batch-mode flag is used with build servers to prevent prompting.

$ mvn release:prepare
...
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @ aar-child-project ---
[INFO] Resuming release from phase 'check-dependency-snapshots'
[INFO] Checking dependencies and plugins for snapshots ...
There are still some remaining snapshot dependencies.
: Do you want to resolve them now? (yes/no) no: : yes 
Dependency type to resolve,: specify the selection number ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ): (0/1/2/3) 1: : 0
Dependency 'org.jboss.aerogear:aar-child-library_extracted' is a snapshot (2.0.0-SNAPSHOT)
: Which release version should it be set to? 2.0.0: : 
What version should the dependency be reset to for development? 2.0.0: : 
What is the release version for "Project"? (org.jboss.aerogear:aar-child-project) 2.0.0: : 
What is the release version for "Library"? (org.jboss.aerogear:aar-child-library) 2.0.0: : 
What is the release version for "Integration Tests"? (org.jboss.aerogear:aar-child-test) 2.0.0: : 
What is SCM release tag or label for "Project"? (org.jboss.aerogear:aar-child-project) aar-child-project-2.0.0: : 
What is the new development version for "Project"? (org.jboss.aerogear:aar-child-project) 2.0.1-SNAPSHOT: : 
What is the new development version for "Library"? (org.jboss.aerogear:aar-child-library) 2.0.1-SNAPSHOT: : 
What is the new development version for "Integration Tests"? (org.jboss.aerogear:aar-child-test) 2.0.1-SNAPSHOT: : 
[INFO] Transforming 'Project'...
[INFO] Transforming 'Library'...
[INFO] Transforming 'Integration Tests'...
[INFO]   Ignoring artifact version update for expression ${project.version}
[INFO]   Ignoring artifact version update for expression ${project.version}
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
...

vs

$ mvn release:prepare --batch-mode
...
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @ aar-child-project ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
[INFO] Executing: /bin/sh -c cd /workspaces/workspace/android-maven-plugin/src/test/projects/aar-child && git status
[INFO] Working directory: /workspaces/workspace/android-maven-plugin/src/test/projects/aar-child
[INFO] Checking dependencies and plugins for snapshots ...
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project aar-child-project: Can't release project due to non released dependencies :
[ERROR] org.jboss.aerogear:aar-child-library_extracted:jar:2.0.0-SNAPSHOT:system
...

Thanks.

secondsun added a commit to secondsun/maven-android-plugin that referenced this issue Jan 12, 2015
…d of appending a string to the created dependency
secondsun added a commit to secondsun/maven-android-plugin that referenced this issue Jan 15, 2015
…d of appending a string to the created dependency
william-ferguson-au added a commit that referenced this issue Jan 17, 2015
Fixing #529

Thanks @secondsun 
This fixes a really annoying I have been having with IntelliJ which was being caused by the _extracted suffix.
@mosabua
Copy link
Member

mosabua commented Mar 24, 2015

Can this be closed?

@william-ferguson-au
Copy link
Contributor

I believe so.
This appears to be one of the the issue fixed by #565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants