out of date. using maven again.
This page explains how to create maven artifacts and deploy them to maven central. It includes information about creating the maven plug-in as well.
First, here is where I was granted permission to push.
Install locally
To test that I can submit a jar without having to build using maven, I did an install. First
$ ./bild.py clean
$ ./bild.py mkjar
$ ./bild.py mksrc
$ ./bild.py mkdoc
$ ./bild.py install
or just
$ ./bild.py install
which copies everything over to the usual maven cache area. We get this:
$ tree /Users/parrt/.m2/repository/org/antlr/antlr4*
/Users/parrt/.m2/repository/org/antlr/antlr4
├── 4.5-SNAPSHOT
│ ├── _remote.repositories
│ ├── antlr4-4.5-SNAPSHOT-javadoc.jar
│ ├── antlr4-4.5-SNAPSHOT-javadoc.jar.md5
│ ├── antlr4-4.5-SNAPSHOT-javadoc.jar.sha1
│ ├── antlr4-4.5-SNAPSHOT-sources.jar
│ ├── antlr4-4.5-SNAPSHOT-sources.jar.md5
│ ├── antlr4-4.5-SNAPSHOT-sources.jar.sha1
│ ├── antlr4-4.5-SNAPSHOT.jar
│ ├── antlr4-4.5-SNAPSHOT.jar.md5
│ ├── antlr4-4.5-SNAPSHOT.jar.sha1
│ ├── antlr4-4.5-SNAPSHOT.pom
│ ├── antlr4-4.5-SNAPSHOT.pom.md5
│ ├── antlr4-4.5-SNAPSHOT.pom.sha1
│ ├── maven-metadata-local.xml
│ ├── maven-metadata-local.xml.md5
│ └── maven-metadata-local.xml.sha1
├── maven-metadata-local.xml
├── maven-metadata-local.xml.md5
└── maven-metadata-local.xml.sha1
/Users/parrt/.m2/repository/org/antlr/antlr4-runtime
├── 4.5-SNAPSHOT
│ ├── _remote.repositories
│ ├── antlr4-runtime-4.5-SNAPSHOT-javadoc.jar
│ ├── antlr4-runtime-4.5-SNAPSHOT-javadoc.jar.md5
│ ├── antlr4-runtime-4.5-SNAPSHOT-javadoc.jar.sha1
│ ├── antlr4-runtime-4.5-SNAPSHOT-sources.jar
│ ├── antlr4-runtime-4.5-SNAPSHOT-sources.jar.md5
│ ├── antlr4-runtime-4.5-SNAPSHOT-sources.jar.sha1
│ ├── antlr4-runtime-4.5-SNAPSHOT.jar
│ ├── antlr4-runtime-4.5-SNAPSHOT.jar.md5
│ ├── antlr4-runtime-4.5-SNAPSHOT.jar.sha1
│ ├── antlr4-runtime-4.5-SNAPSHOT.pom
│ ├── antlr4-runtime-4.5-SNAPSHOT.pom.md5
│ ├── antlr4-runtime-4.5-SNAPSHOT.pom.sha1
│ ├── maven-metadata-local.xml
│ ├── maven-metadata-local.xml.md5
│ └── maven-metadata-local.xml.sha1
├── maven-metadata-local.xml
├── maven-metadata-local.xml.md5
└── maven-metadata-local.xml.sha1
Looks fine and so now we have to get it up to maven central.
Deploy snapshot
Remove old snapshots
Go to sonatype view repos and put https://oss.sonatype.org/content/repositories/snapshots
into the search box to find the repository. click on the repository that comes up and then type org/antlr/antlr4...
into the search box in the pane below. It should show you all of the artifacts and then you can right-click and delete stuff.
Deploying jars built from bild.py
Any version with -SNAPSHOT in it is not a stable release.
First we need to set up authentication in ~/.m2/settings.xml
. It should minimally have the following:
$ vi settings.xml
<settings>
<servers>
<server>
<id>ossrh</id> <!-- this is the repository id you must use for the deploy -->
<username>parrt</username>
<password>####</password>
</server>
</servers>
</settings>
Then, just run
./deploy.py mvn_snapshot
optionally with -debug
.
which will ensure that everything is built and push all of the appropriate jars to the snapshot area of maven central. This of course assumes that your version has -SNAPSHOT
as a suffix.
Deploying SNAPSHOT jars manually (those built from bild.py)
# must correspond to <id>ossrh</id> in settings.xml
$ mvn deploy:deploy-file -Durl=https://oss.sonatype.org/content/repositories/snapshots \
-DrepositoryId=ossrh \
-Dfile=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-complete.jar \
-Dsources=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-complete-sources.jar \
-Djavadoc=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-complete-javadoc.jar \
-DgroupId=org.antlr \
-DartifactId=antlr4 \
-Dversion=4.5-SNAPSHOT \
-Dpackaging=jar \
-DpomFile=/Users/parrt/antlr/code/antlr4/tool/pom.xml \
-DuniqueVersion=true \
-DgeneratePom=false
...
Uploaded: https://oss.sonatype.org/content/repositories/snapshots/org/antlr/antlr4-master/4.5-SNAPSHOT/antlr4-master-4.5-20150113.015645-2.jar (1892 KB at 1740.6 KB/sec)
Holy crap! It worked! Do it for the runtime now:
$ mvn deploy:deploy-file -Durl=https://oss.sonatype.org/content/repositories/snapshots \
-DrepositoryId=ossrh \
-Dfile=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT.jar \
-Dsources=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-sources.jar \
-Djavadoc=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-javadoc.jar \
-DgroupId=org.antlr \
-DartifactId=antlr4-runtime \
-Dversion=4.5-SNAPSHOT \
-DpomFile=/Users/parrt/antlr/code/antlr4/runtime/Java/pom.xml \
-DuniqueVersion=true \
-Dpackaging=jar \
-DgeneratePom=false
...
Uploaded: https://oss.sonatype.org/content/repositories/snapshots/org/antlr/antlr4-runtime/4.5-SNAPSHOT/antlr4-runtime-4.5-20150113.015947-1.jar (372 KB at 357.5 KB/sec)
...
Wow. It sticks stuff here:
https://oss.sonatype.org/content/repositories/snapshots/org/antlr/antlr4/4.5-SNAPSHOT/
https://oss.sonatype.org/content/repositories/snapshots/org/antlr/antlr4-runtime/4.5-SNAPSHOT/
Deploy ANTLR maven plugin
Apparently mvn deploy
is not good enough and we need to sign the pom and jar. I added this to my ~/.m2/settings.xml
file:
<profiles>
<profile>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<gpg.keyname>55DBXXXX</gpg.keyname>
</properties>
</profile>
</profiles>
I also had to update the pom.xml in the ANTLR maven plug-in dir to include signing stuff.
At that point, this will work:
mvn deploy
It asks me for my passphrase.
Deploying release jars manually (those built from bild.py)
According to:
http://central.sonatype.org/pages/requirements.html
we have to use PGP to sign all of the artifacts. So first we need to do this:
http://central.sonatype.org/pages/working-with-pgp-signatures.html
$ brew install gpg
$ gpg --gen-key # if you have not set this up
$ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys 55DBXXXX # export your public key
gpg: sending key 55DBXXXX to hkp server pool.sks-keyservers.net
Then sign and verify all of the artifacts:
$ gpg -ab dist/antlr4-4.5-complete.jar # sign it
... asks for your passphrase each time ...
$ gpg --verify dist/antlr4-4.5-complete.jar.asc
gpg: Signature made Fri Jan 23 13:02:24 2015 PST using RSA key ID XXXXXXX
gpg: Good signature from "Terence Parr (ANTLR Project Lead) <parrt@antlr.org>"
Or with a loop:
for f in dist/antlr4-*.jar
do
gpg -ab $f
gpg --verify $f.asc
done
Ok, here are the instructions it looks like for manual deploy:
http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html
The following does the signing along with the deploy it looks like. The following worked after I entered my passphrase two times:
mvn gpg:sign-and-deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=ossrh \
-Dpackaging=jar \
-DpomFile=/Users/parrt/antlr/code/antlr4/tool/pom.xml \
-Dfile=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-complete.jar \
-Dsources=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-complete-sources.jar \
-Djavadoc=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-complete-javadoc.jar
I believe you can do this multiple times to make sure you have the latest stuff up there; it's only when we go to the website and deploy that it gets released.
It uploaded stuff like:
https://oss.sonatype.org/service/local/staging/deploy/maven2/org/antlr/antlr4/4.5/antlr4-4.5.jar
https://oss.sonatype.org/service/local/staging/deploy/maven2/org/antlr/antlr4/4.5/antlr4-4.5.pom
https://oss.sonatype.org/service/local/staging/deploy/maven2/org/antlr/antlr4/maven-metadata.xml
https://oss.sonatype.org/service/local/staging/deploy/maven2/org/antlr/antlr4/4.5/antlr4-4.5.pom.asc
https://oss.sonatype.org/service/local/staging/deploy/maven2/org/antlr/antlr4/4.5/antlr4-4.5.jar.asc
Notice that the artifact ID is antlr4
not antlr4-complete
, which is used as part of the jar name available for download (the stuff not part of maven).
mvn gpg:sign-and-deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=ossrh \
-Dpackaging=jar \
-DpomFile=/Users/parrt/antlr/code/antlr4/runtime/Java/pom.xml \
-Dfile=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5.jar \
-Dsources=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-sources.jar \
-Djavadoc=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-javadoc.jar
Before it will appear here:
https://oss.sonatype.org/content/repositories/releases/org/antlr/antlr4/
we must manually go to the sonatype website as described here:
http://central.sonatype.org/pages/releasing-the-deployment.html
It looks like when you do the deploy of the plug-in or these manual sign and deploys, it creates a "bundle" in the staging repositories area:
https://oss.sonatype.org/#stagingRepositories
Mine was the last one because I had just pushed it but it will be something like organtlr-1-26
. When you think you have the right stuff in there, after being able to push multiple times, you can hit the close button above the list of bundles and it will evaluate things according to the requirements.
If it passes then you can release it by pressing the Release button. heh, cool. I got email from them that says:
...
The following artifacts have been staged
/org/antlr/antlr4-maven-plugin/4.5/antlr4-maven-plugin-4.5.pom.asc
(SHA1: ebd1341c7821ebfa52452718fc8ce11fe7d441cc)
/org/antlr/antlr4-maven-plugin/4.5/antlr4-maven-plugin-4.5.pom
(SHA1: f52c70be1f236217479a7b9940b17b0933fdbe27)
/org/antlr/antlr4-maven-plugin/4.5/antlr4-maven-plugin-4.5.jar.asc
(SHA1: 0f71fa13e2391c299b7580ad73bacb3a2e5062b4)
/org/antlr/antlr4-maven-plugin/4.5/antlr4-maven-plugin-4.5.jar
(SHA1: 9de4907ee6223f9dd47de5238af24de26af80d0f)
...
Now I have it in deploy:
./deploy mvn_deploy
Manual (non bild.py) install to .m2
Ok, so I will stick with the dist dir.
$ rm -rf ~/.m2/repository/org/antlr/antlr4*
$ cd /tmp
$ mvn install:install-file \
-Dfile=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-complete.jar \
-Dversion=4.5-SNAPSHOT \
-DgeneratePom=true \
-DgroupId=org.antlr \
-DartifactId=antlr4-master \
-Dpackaging=jar
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ANTLR 4
[INFO] ANTLR 4 Runtime Annotations
[INFO] ANTLR 4 Runtime
[INFO] ANTLR 4 Tool
[INFO] ANTLR 4 Maven plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ANTLR 4 4.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ antlr4-master ---
[INFO] Installing /Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT-complete.jar to /Users/parrt/.m2/repository/org/antlr/antlr4-master/4.5-SNAPSHOT/antlr4-master-4.5-SNAPSHOT.jar
[INFO] Installing /var/folders/kg/rssn5crj5630ncbrjfgw8w_80000gn/T/mvninstall1942532678594453416.pom to /Users/parrt/.m2/repository/org/antlr/antlr4-master/4.5-SNAPSHOT/antlr4-master-4.5-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ANTLR 4 ........................................... SUCCESS [0.219s]
[INFO] ANTLR 4 Runtime Annotations ....................... SKIPPED
[INFO] ANTLR 4 Runtime ................................... SKIPPED
[INFO] ANTLR 4 Tool ...................................... SKIPPED
[INFO] ANTLR 4 Maven plugin .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.959s
[INFO] Finished at: Mon Jan 12 20:15:31 PST 2015
[INFO] Final Memory: 7M/20M
[INFO] ------------------------------------------------------------------------
$
That seems to work and without using a pom file. (I jumped up to the tmp
dir notice). Ok, now for the runtime:
$ mvn install:install-file \
-Dfile=/Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT.jar \
-Dversion=4.5-SNAPSHOT \
-DgeneratePom=true \
-DgroupId=org.antlr \
-DartifactId=antlr4-runtime \
-Dpackaging=jar
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ANTLR 4
[INFO] ANTLR 4 Runtime Annotations
[INFO] ANTLR 4 Runtime
[INFO] ANTLR 4 Tool
[INFO] ANTLR 4 Maven plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ANTLR 4 4.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ antlr4-master ---
[INFO] Installing /Users/parrt/antlr/code/antlr4/dist/antlr4-4.5-SNAPSHOT.jar to /Users/parrt/.m2/repository/org/antlr/antlr4-runtime/4.5-SNAPSHOT/antlr4-runtime-4.5-SNAPSHOT.jar
[INFO] Installing /var/folders/kg/rssn5crj5630ncbrjfgw8w_80000gn/T/mvninstall8348667768605639723.pom to /Users/parrt/.m2/repository/org/antlr/antlr4-runtime/4.5-SNAPSHOT/antlr4-runtime-4.5-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ANTLR 4 ........................................... SUCCESS [0.230s]
[INFO] ANTLR 4 Runtime Annotations ....................... SKIPPED
[INFO] ANTLR 4 Runtime ................................... SKIPPED
[INFO] ANTLR 4 Tool ...................................... SKIPPED
[INFO] ANTLR 4 Maven plugin .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.980s
[INFO] Finished at: Mon Jan 12 20:17:12 PST 2015
[INFO] Final Memory: 7M/20M
[INFO] ------------------------------------------------------------------------