diff --git a/.gitignore b/.gitignore
index 9cfedb7df7..fec4747316 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
*.pyc
/gwt-unitCache
*.swp
+*.asc
diff --git a/Documentation/dev-buck.txt b/Documentation/dev-buck.txt
index 2bcf5c25fd..23139d85aa 100644
--- a/Documentation/dev-buck.txt
+++ b/Documentation/dev-buck.txt
@@ -135,34 +135,12 @@ Install {extension,plugin,gwt}-api to the local maven repository:
buck build api_install
----
-Deploy {extension,plugin,gwt}-api to the remote maven repository:
-
-----
- buck build api_deploy
-----
-
Install gerrit.war to the local maven repository:
----
buck build war_install
----
-Deploy gerrit.war to the remote maven repository:
-
-----
- buck build war_deploy
-----
-
-The type of the repo is induced from the Gerrit version name, i.e.
-
-* `2.9-SNAPSHOT`: snapshot repo
-* `2.9`: release repo
-
-Deploying to the remote repository still depends on Maven, and the credentials
-for the repository need to be
-link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
-configured in Maven's settings.xml file].
-
=== Plugins
To build all core plugins:
diff --git a/Documentation/dev-release-deploy-config.txt b/Documentation/dev-release-deploy-config.txt
index 4a4e8946d3..83c28da644 100644
--- a/Documentation/dev-release-deploy-config.txt
+++ b/Documentation/dev-release-deploy-config.txt
@@ -1,6 +1,48 @@
= Deploy Gerrit Artifacts
-Gerrit Artifacts are stored on
+[[deploy-configuration-setting-maven-central]]
+== Deploy Configuration settings for Maven Central
+
+Gerrit Extension API Jar and the Gerrit Plugin API artifacts are stored on
+Maven Central.
+
+Prerequisites: Set up the Sonatype account (see link:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-2.Signup[Sonatype
+Maven Repository Usage Guide]) and put Sonatype user and password in
+~/.m2/settings.xml:
+
+----
+
+ sonatype-nexus-staging
+ USER
+ PASSWORD
+
+----
+
+PGP key must be generated and published, see
+link:https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven[How
+To Generate PGP Signatures With Maven] for details. PGP passphrase can also be
+put in ~/.m2/settings.xml:
+
+----
+
+
+
+ gpg
+
+ gpg2
+ mypassphrase
+
+
+
+
+ gpg
+
+
+----
+
+It can also be included in the key chain on OS X.
+
+Gerrit Subproject Artifacts are stored on
link:https://developers.google.com/storage/[Google Cloud Storage].
Via the link:https://code.google.com/apis/console/?noredirect[API Console] the
Gerrit maintainers have access to the `Gerrit Code Review` project.
diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt
index 1af54c7a04..2495233616 100644
--- a/Documentation/dev-release.txt
+++ b/Documentation/dev-release.txt
@@ -141,29 +141,32 @@ for the Subproject in `/lib/BUCK` to the released version.
==== Publish the Extension and Plugin API Jars
* Make sure you have done the
-link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
+link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
configuration needed for deployment]
-* Push the Jars to the storage bucket:
+* Push the Jars to the Maven Central:
+
----
buck build api_deploy
----
+* Troubleshooting: to see the commands that are execured in Buck build process
+environment variable VERBOSE can be set:
++
+----
+ VERBOSE=1 buck build api_deploy
+----
[[publish-gerrit-war]]
==== Publish the Gerrit WAR (with Core Plugins)
-* The WAR file to upload is `buck-out/gen/release.war`
-* Upload WAR to the storage bucket via `https://cloud.google.com/console` (manual via web browser)
-* Push the WAR file to the Maven storage bucket:
+* Push the WAR to the Maven Central:
+
----
buck build war_deploy
----
-
[[push-stable]]
==== Push the Stable Branch
@@ -293,6 +296,17 @@ included in the next Gerrit release. Update the Gerrit version in the
for review and get it merged.
+[[publish-plugins-archetypes-to-maven-central]]
+=== Publish plugin archetypes to Maven Central
+
+Make sure you have done the
+link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
+configuration needed for deployment]
+
+----
+ ./tools/plugin_archetype_deploy.sh
+----
+
[[merge-stable]]
=== Merge `stable` into `master`
diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml
new file mode 100644
index 0000000000..e8031ef92b
--- /dev/null
+++ b/gerrit-war/pom.xml
@@ -0,0 +1,59 @@
+
+ 4.0.0
+ com.google.gerrit
+ gerrit-war
+ 2.9-SNAPSHOT
+ war
+ Gerrit Code Review - WAR
+ Gerrit WAR
+ http://code.google.com/p/gerrit/
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ https://gerrit.googlesource.com/gerrit
+ https://gerrit.googlesource.com/gerrit
+
+
+
+
+ Dave Borowitz
+
+
+ David Pursehouse
+
+
+ Edwin Kempin
+
+
+ Martin Fick
+
+
+ Saša Živkov
+
+
+ Shawn Pearce
+
+
+
+
+
+ Repo and Gerrit Discussion
+ repo-discuss@googlegroups.com
+ https://groups.google.com/forum/#!forum/repo-discuss
+ https://groups.google.com/forum/#!forum/repo-discuss
+ https://groups.google.com/forum/#!forum/repo-discuss
+
+
+
+
+ http://code.google.com/p/gerrit/issues/list
+ Google Code Issue Tracker
+
+
diff --git a/tools/maven/BUCK b/tools/maven/BUCK
index b6b501e20b..4d53783848 100644
--- a/tools/maven/BUCK
+++ b/tools/maven/BUCK
@@ -1,11 +1,13 @@
include_defs('//VERSION')
include_defs('//tools/maven/package.defs')
-TYPE = 'snapshot' if GERRIT_VERSION.endswith('-SNAPSHOT') else 'release'
+URL = 'https://oss.sonatype.org/content/repositories/snapshots' \
+ if GERRIT_VERSION.endswith('-SNAPSHOT') else \
+ 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
maven_package(
- repository = 'gerrit-api-repository',
- url = 'gs://gerrit-api/%s' % TYPE,
+ repository = 'sonatype-nexus-staging',
+ url = URL,
version = GERRIT_VERSION,
jar = {
'gerrit-extension-api': '//gerrit-extension-api:extension-api',
diff --git a/tools/maven/fake_pom_deploy.xml b/tools/maven/fake_pom_deploy.xml
deleted file mode 100644
index a531200a9b..0000000000
--- a/tools/maven/fake_pom_deploy.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
- 4.0.0
- com.google.gerrit
- Gerrit-Code-Review-Maven
- 1
-
-
- gerrit-api-repository
- Gerrit API Repository
- gs://gerrit-api
- true
-
-
-
-
-
- com.googlesource.gerrit
- gs-maven-wagon
- 3.3
-
-
-
-
-
- gerrit-maven-repository
- https://gerrit-maven.storage.googleapis.com/
-
-
-
diff --git a/tools/maven/fake_pom_install.xml b/tools/maven/fake_pom_install.xml
deleted file mode 100644
index d066a4a97c..0000000000
--- a/tools/maven/fake_pom_install.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- 4.0.0
- com.google.gerrit
- Gerrit-Code-Review-Maven
- 1
-
diff --git a/tools/maven/mvn.py b/tools/maven/mvn.py
index a4aaa5aba0..9e36b4839e 100644
--- a/tools/maven/mvn.py
+++ b/tools/maven/mvn.py
@@ -15,14 +15,11 @@
from __future__ import print_function
from optparse import OptionParser
-from os import path
+from os import path, environ
from sys import stderr
from tools.util import check_output
-def mvn(action):
- return ['mvn', '--file', path.join(self, 'fake_pom_%s.xml' % action)]
-
opts = OptionParser()
opts.add_option('--repository', help='maven repository id')
opts.add_option('--url', help='maven repository url')
@@ -36,33 +33,38 @@ if not args.v:
print('version is empty', file=stderr)
exit(1)
-common = [
- '-DgroupId=com.google.gerrit',
- '-Dversion=%s' % args.v,
-]
-
-self = path.dirname(path.abspath(__file__))
+root = path.abspath(__file__)
+for _ in range(0, 3):
+ root = path.dirname(root)
if 'install' == args.a:
- cmd = mvn(args.a) + ['install:install-file'] + common
+ cmd = [
+ 'mvn',
+ 'install:install-file',
+ '-Dversion=%s' % args.v,
+ ]
elif 'deploy' == args.a:
- cmd = mvn(args.a) + [
- 'deploy:deploy-file',
+ cmd = [
+ 'mvn',
+ 'gpg:sign-and-deploy-file',
'-DrepositoryId=%s' % args.repository,
'-Durl=%s' % args.url,
- ] + common
+ ]
else:
print("unknown action -a %s" % args.a, file=stderr)
exit(1)
for spec in args.s:
artifact, packaging_type, src = spec.split(':')
+ exe = cmd + [
+ '-DpomFile=%s' % path.join(root, '%s/pom.xml' % artifact),
+ '-Dpackaging=%s' % packaging_type,
+ '-Dfile=%s' % src,
+ ]
try:
- check_output(cmd + [
- '-DartifactId=%s' % artifact,
- '-Dpackaging=%s' % packaging_type,
- '-Dfile=%s' % src,
- ])
+ if environ.get('VERBOSE'):
+ print(' '.join(exe), file=stderr)
+ check_output(exe)
except Exception as e:
print('%s command failed: %s' % (args.a, e), file=stderr)
exit(1)
diff --git a/tools/plugin_archetype_deploy.sh b/tools/plugin_archetype_deploy.sh
new file mode 100755
index 0000000000..929e1fd59d
--- /dev/null
+++ b/tools/plugin_archetype_deploy.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+help()
+{
+ cat <<'eof'
+Usage: plugin_archetype_deploy [option]
+
+Deploys Gerrit plugin Maven archetypes to Maven Central
+
+Valid options:
+ --help show this message
+ --dry-run don't execute commands, just print them
+eof
+exit
+}
+
+function getver
+{
+ grep "$1" $root/VERSION | sed "s/.*'\(.*\)'/\1/"
+}
+
+function instroot
+{
+ bindir=${0%/*}
+
+ case $bindir in
+ ./*) bindir=$PWD/$bindir ;;
+ esac
+
+ cd $bindir/..
+ pwd
+}
+
+function doIt
+{
+ case $dryRun in
+ true) echo "$@" ;;
+ *) "$@" ;;
+ esac
+}
+
+function build_and_deploy
+{
+ module=${PWD##*/}
+ doIt mvn package gpg:sign-and-deploy-file \
+ -Durl=$url \
+ -DrepositoryId=sonatype-nexus-staging \
+ -DpomFile=pom.xml \
+ -Dfile=target/$module-$ver.jar
+}
+
+while [ $# -gt 0 ]; do
+ test "$1" == --dry-run && dryRun=true
+ test "$1" == --help && help
+ shift
+done
+
+root=$(instroot)
+cd "$root"
+ver=$(getver GERRIT_VERSION)
+[[ $ver == *-SNAPSHOT ]] \
+ && url="https://oss.sonatype.org/content/repositories/snapshots" \
+ || url="https://oss.sonatype.org/service/local/staging/deploy/maven2"
+
+for d in gerrit-plugin-archetype \
+ gerrit-plugin-js-archetype \
+ gerrit-plugin-gwt-archetype ; do
+ (cd "$d"; build_and_deploy)
+done
+
diff --git a/tools/version.py b/tools/version.py
index 92143bac6c..a994bd8539 100755
--- a/tools/version.py
+++ b/tools/version.py
@@ -32,7 +32,8 @@ pattern = re.compile(r'(\s*)[-.\w]+')
for project in ['gerrit-extension-api', 'gerrit-plugin-api',
'gerrit-plugin-archetype', 'gerrit-plugin-gwt-archetype',
- 'gerrit-plugin-gwtui', 'gerrit-plugin-js-archetype']:
+ 'gerrit-plugin-gwtui', 'gerrit-plugin-js-archetype',
+ 'gerrit-war']:
pom = os.path.join(project, 'pom.xml')
try:
outxml = ""