sources jar has bad versions.properties resource

Description

The "sources" jar (at least since Clojure 1.4 and including 1.5 RC) has a bad version.properties file in it. The resource clojure/version.properties is literally:

The regular Clojure jar has the correct version string in that resource.

I came across a problem when I was experimenting with the sources jar (as used by IDEs). I naively added the sources jar to my classpath, and Clojure died on start up. The bad clojure/versions.properties file was found first, which led to a parse error as the clojure version was being set.

Cause: We configure the maven-source-plugin plugin in our pom.xml to exclude the clojure/version.properties file, and this works for SNAPSHOT builds but NOT for release builds. One difference during release builds is that we are running different goals and profiles, which seems to cause the configuration for the maven-source-plugin to be configured as defined in the oss-parent pom (https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom) instead of our configuration, and so the exclusion is not done.

Solution: If we use the same execution id as used in the oss-parent for the maven-source-plugin configuration, our configuration will override the parent pom configuration and the exclusion will take effect, both in snapshot builds and in release builds. The patch makes this change, just using "attach-sources" as the execution id.

Patch: clj-1161.patch

I was able to reproduce the bad source jar locally by running a command like:

Note that this will generate some local files AND make a local tag and commit! So be careful testing locally if you have commit access (Stu!). You can undo that commit with `git reset HEAD~1` and the tag with `git tag -d whatever`. Before the patch, you should see:

After, you should see that target/clojure-1.8.0-xyz-sources.jar does not contain clojure/version.properties at all:

Environment

None

Attachments

2

Activity

Show:

Bozhidar Batsov December 15, 2015 at 8:53 PM

Fantastic news!

Alex Miller December 15, 2015 at 2:57 PM

While the final fix was simple, it took many painful hours of Maven detective work to track it down. We are on track to get it in the next RC.

Bozhidar Batsov December 15, 2015 at 7:38 AM

I really hope this is finally going to be resolved. It has caused us quite a lot of pain in CIDER.

Alex Miller December 12, 2015 at 3:47 AM

Thanks for bumping this - I keep meaning to look at it.

Michael Griffiths December 11, 2015 at 9:43 PM

This still seems to be the case for the 1.7 and 1.8 sources jars; version.properties contains the above in both https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0/clojure-1.7.0-sources.jar and https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0-RC3/clojure-1.8.0-RC3-sources.jar

Completed

Details

Assignee

Reporter

Labels

Approval

Ok

Patch

Code

Priority

Affects versions

Fix versions

Created February 11, 2013 at 4:03 PM
Updated December 16, 2015 at 9:18 PM
Resolved December 16, 2015 at 9:18 PM