How to update pom to Gerrit 2.2.2?

136 views
Skip to first unread message

Martin Fick

unread,
Dec 19, 2011, 2:07:52 PM12/19/11
to Shawn Pearce, Repo and Gerrit Discussion
Shawn,

How do I go about updating the Gerrit pom to 2.2.2-rc0?
When I do, I get the errors below from maven. Then I
noticed that the other releases (v2.1.8, v2.2.1) did not
actually update the pom to a full revision, they still have
SNAPSHOT in them for the Gerrit version #. Could you
explain to me what I am supposed to do to prepare the 2.2.2-
rc0 release? I pushed this change:

https://gerrit-review.googlesource.com/#/c/30650/

but it fails to build with the problems below.

Thanks,

-Martin

[INFO] Error building POM (may not be this project's POM).


Project ID: null:gerrit-patch-commonsnet:jar:null

Reason: Cannot find parent: com.google.gerrit:gerrit-parent
for project: null:gerrit-patch-commonsnet:jar:null for
project null:gerrit-patch-commonsnet:jar:null


[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot
find parent: com.google.gerrit:gerrit-parent for project:
null:gerrit-patch-commonsnet:jar:null for project
null:gerrit-patch-commonsnet:jar:null
at
org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at
org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at
org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at
org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by:
org.apache.maven.project.ProjectBuildingException: Cannot
find parent: com.google.gerrit:gerrit-parent for project:
null:gerrit-patch-commonsnet:jar:null for project
null:gerrit-patch-commonsnet:jar:null
at
org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1396)
at
org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
at
org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
at
org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
at
org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
at
org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
at
org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:560)
at
org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
... 12 more
Caused by:
org.apache.maven.project.ProjectBuildingException: POM
'com.google.gerrit:gerrit-parent' not found in repository:
Unable to download the artifact from any repository

com.google.gerrit:gerrit-parent:pom:2.2-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

for project com.google.gerrit:gerrit-parent
at
org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
at
org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
... 19 more
Caused by:
org.apache.maven.artifact.resolver.ArtifactNotFoundException:
Unable to download the artifact from any repository

com.google.gerrit:gerrit-parent:pom:2.2-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2)


at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
at
org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
... 20 more
Caused by:
org.apache.maven.wagon.ResourceDoesNotExistException: Unable
to download the artifact from any repository
at
org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
... 22 more
[INFO] ---------------------

--
Employee of Qualcomm Innovation Center, Inc. which is a
member of Code Aurora Forum

Matthias Sohn

unread,
Dec 19, 2011, 3:57:12 PM12/19/11
to Martin Fick, Shawn Pearce, Repo and Gerrit Discussion
I think you need the following:

- server side branch which has all the changes which should go into the release
candidate, I would do that on a separate branch (maybe stable is the right one
but then you need to merge all changes from master which are supposed to be
part of the release candidate) so that changes which shouldn't go into 2.2.2 can 
be submitted into master without being blocked by 2.2.2 preparations

- the parent pom.xml in the root lists all the maven modules, but the module 
pom.xml files also refer back to the parent, hence you need to flip the version 
in the parent pom

  <groupId>com.google.gerrit</groupId>
  <artifactId>gerrit-parent</artifactId>
  <packaging>pom</packaging>
  <version>2.2.2-rc0</version>

and in also all modules you need to flip the version of the back reference
to the parent pom:

  <parent>
    <groupId>com.google.gerrit</groupId>
    <artifactId>gerrit-parent</artifactId>
    <version>2.2.2-rc0</version>
  </parent>

- I guess this can be done using the two scripts
./tools/version.sh
./tools/release.sh
these look similar to the scripts we use to flip the versions
for JGit releases. Looking at release.sh (without trying that)
I would guess you need to create a local signed tag v2.2.2-rc0
(matching the version number you want to release) pointing at the commit 
you want to release and then run ./tools/release.sh to create the release
If you look at the release.sh script this also explains why you don't
find the version version flipping change in the repository.

- I am not sure if we also need a new release for gwtorm (master and
stable point at different commits at the moment)

--
Matthias

2011/12/19 Martin Fick <mf...@codeaurora.org>

Martin Fick

unread,
Dec 19, 2011, 5:18:59 PM12/19/11
to Matthias Sohn, Shawn Pearce, Repo and Gerrit Discussion
On Monday, December 19, 2011 01:57:12 pm Matthias Sohn
wrote:

> I think you need the following:

> - the parent pom.xml in the root lists all the maven

> modules, but the module
> pom.xml files also refer back to the parent, hence you
> need to flip the version
> in the parent pom
>
> <groupId>com.google.gerrit</groupId>
> <artifactId>gerrit-parent</artifactId>
> <packaging>pom</packaging>
> <version>2.2.2-rc0</version>


So, any clue why all the other tagged releases point to a
SNAPSHOT version here in git? It seems wrong of me to do
this differently than the previous releases.

-Martin

Matthias Sohn

unread,
Dec 19, 2011, 5:28:17 PM12/19/11
to Martin Fick, Shawn Pearce, Repo and Gerrit Discussion
2011/12/19 Martin Fick <mf...@codeaurora.org>
I think this is caused by the following lines in release.sh:

./tools/version.sh --release &&
mvn clean package $include_docs
rc=$?
./tools/version.sh --reset

I think this bumps the versions to the version given by the tag on current HEAD
then it runs the maven build to produce the binary release and finally it seems
it's resetting the versions back to snapshot, looking at version.sh 

--reset)
git checkout HEAD -- $POM_FILES

this seems to simply undo the version flipping changes done in the pom files.

As far as I can see this will only work if you run the release build locally and
if you want to reproduce the release build you have to run this procedure
again which should be possible based on the tag. 

--
Matthias

Martin Fick

unread,
Dec 19, 2011, 5:33:27 PM12/19/11
to Matthias Sohn, Shawn Pearce, Repo and Gerrit Discussion
On Monday, December 19, 2011 03:28:17 pm Matthias Sohn
wrote:

OK, so then how to I push a proposed 2.2.2-rc0 for review?
It sounds like you are saying that I can't, that I can only
tag my current repo as such, and then I could push that tag
to upstream. But since Gerrit doesn't review tags... that
would bypass review?

I am looking for advice on how to proceed,

-Martin

Matthias Sohn

unread,
Dec 19, 2011, 6:41:41 PM12/19/11
to Martin Fick, Shawn Pearce, Repo and Gerrit Discussion
yeah, I think review isn't possible this way, then you may try
the following (that's what we are doing for JGit releases were
we do review and run the release build on hudson) though
I didn't try this with Gerrit so I am not 100% sure : 

- tag locally creating signed tag "v2.2.2-rc0"
- run ./tools/version.sh --release to flip the versions
- commit that
- now the tag is on the wrong commit -> delete the existing local tag
  and recreate it now on the commit containing the release versions
- create the release build to produce the binary release
- simply revert the version flipping change to switch back to snapshot
  amend this to include changeid
- ensure this is the immediate next commit after the rc so that
  we don't end up with two different source versions having the same
  maven versions.
- push these 2 commits for review (don't push the tag yet)
- when review is passed and changes are submitted push the tag to the server

--
Matthias

Shawn Pearce

unread,
Dec 19, 2011, 8:43:31 PM12/19/11
to Martin Fick, Matthias Sohn, Repo and Gerrit Discussion
On Mon, Dec 19, 2011 at 14:33, Martin Fick <mf...@codeaurora.org> wrote:
>> I think this is caused by the following lines in
>> release.sh:
>>
>> ./tools/version.sh --release &&
>> mvn clean package $include_docs
>> rc=$?
>> ./tools/version.sh --reset
>>
>> As far as I can see this will only work if you run the
>> release build locally and
>> if you want to reproduce the release build you have to
>> run this procedure again which should be possible based
>> on the tag.
>
> OK, so then how to I push a proposed 2.2.2-rc0 for review?

You don't. The way I have done this in the past has been:

git tag -a -m "gerrit 2.2.2-rc0" v2.2.2-rc0
./tools/release.sh

sanity check WAR
upload WAR to code.google.com/p/gerrit
push v2.2.2-rc0 tag

If my "sanity check" didn't pass, I delete the tag and try again.

Martin Fick

unread,
Dec 19, 2011, 9:25:49 PM12/19/11
to Shawn Pearce, Matthias Sohn, Repo and Gerrit Discussion


Shawn Pearce <s...@google.com> wrote:

Thanks Shawn. I will use this change with the updated pom as a discussion point for reviewing the proposed release before following your procedure:

https://gerrit-review.googlesource.com/#/c/30650/

-Martin

Employee of Qualcomm Innovation Center,Inc. which is a member of Code Aurora Forum

Martin Fick

unread,
Dec 20, 2011, 12:44:45 PM12/20/11
to Shawn Pearce, Repo and Gerrit Discussion
On Monday, December 19, 2011 06:43:31 pm Shawn Pearce wrote:
> On Mon, Dec 19, 2011 at 14:33, Martin Fick
<mf...@codeaurora.org> wrote:
> >> I think this is caused by the following lines in
> >> release.sh:
> >>
> >> ./tools/version.sh --release &&
> >> mvn clean package $include_docs
> >> rc=$?
> >> ./tools/version.sh --reset
> >>
> >> As far as I can see this will only work if you run the
> >> release build locally and
> >> if you want to reproduce the release build you have to
> >> run this procedure again which should be possible
> >> based on the tag.
> >
> > OK, so then how to I push a proposed 2.2.2-rc0 for
> > review?
>
> You don't. The way I have done this in the past has been:
>
> git tag -a -m "gerrit 2.2.2-rc0" v2.2.2-rc0
> ./tools/release.sh
>
> sanity check WAR
> upload WAR to code.google.com/p/gerrit

Do you do a manual upload for this step?

mvn deploy complains with:

[INFO] Installing
/local/mnt/workspace/gerrit/gerrit3/pom.xml to
/usr2/mfick/.m2/repository/com/google/gerrit/gerrit-
parent/2.2-SNAPSHOT/gerrit-parent-2.2-SNAPSHOT.pom
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for:
org.apache.maven.plugins:maven-deploy-plugin:2.4

check that the following section of the pom.xml is present
and correct:

<distributionManagement>
<!-- use the following if you're not using a snapshot
version. -->
<repository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</repository>
<!-- use the following if you ARE using a snapshot
version. -->
<snapshotRepository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</snapshotRepository>
</distributionManagement>

Cause: Class
'org.apache.maven.artifact.repository.ArtifactRepository'
cannot be instantiated

Shawn Pearce

unread,
Dec 20, 2011, 12:55:12 PM12/20/11
to Martin Fick, Repo and Gerrit Discussion
On Tue, Dec 20, 2011 at 09:44, Martin Fick <mf...@codeaurora.org> wrote:
> On Monday, December 19, 2011 06:43:31 pm Shawn Pearce wrote:
>>   git tag -a -m "gerrit 2.2.2-rc0" v2.2.2-rc0
>>   ./tools/release.sh
>>
>>   sanity check WAR
>>   upload WAR to code.google.com/p/gerrit
>
> Do you do a manual upload for this step?

Yes. I manually poke my web browser to upload the file. I don't do it
often enough to have bothered with automating the upload. And I doubt
Maven has a plugin that can upload a file to the Google Code Project
Hosting downloads area.

Matthias Sohn

unread,
Dec 20, 2011, 4:52:08 PM12/20/11
to Shawn Pearce, Martin Fick, Repo and Gerrit Discussion
Reply all
Reply to author
Forward
0 new messages