Clojure

clojure runtime does not work with onejar-maven-plugin

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: Release 1.5, Release 1.6, Release 1.7
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    I was able to repeat this problem on windows, linux, and osx
  • Patch:
    Code

Description

I have created a sample project, steps to repeat the problem, and a proposed patch here:
https://github.com/SeanShubin/clojure-one-jar

I have also attached my proposed patch to this ticket, and pasted the relevant portion of README.md below:

clojure-one-jar
===============

Sample project to demonstrate problem with combining clojure runtime with onejar-maven-plugin

Steps to repeat the problem
===========================

  • mvn package
  • java -jar target/greeter.jar

Behavior before patch is applied
================================
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.simontuffs.onejar.Boot.run(Boot.java:340)
at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.ExceptionInInitializerError
at com.seanshubin.clojure_one_jar.Greeter.main(Greeter.java:12)
... 6 more
Caused by: java.lang.NullPointerException
at clojure.lang.RT.lastModified(RT.java:387)
at clojure.lang.RT.load(RT.java:421)
at clojure.lang.RT.load(RT.java:411)
at clojure.lang.RT.doInit(RT.java:447)
at clojure.lang.RT.<clinit>(RT.java:329)
... 7 more

Behavior after patch is applied
===============================
No need to call RT.init() anymore
Hello, world!

Patch
=====
I applied this patch to my local copy of clojure 1.7.0-master-SNAPSHOT
https://github.com/SeanShubin/clojure-one-jar/blob/master/onejar-maven-plugin-fix.patch

Activity

Hide
Alex Miller added a comment -

I think this is a dupe of CLJ-971 - can you verify?

Show
Alex Miller added a comment - I think this is a dupe of CLJ-971 - can you verify?
Hide
Sean Shubin added a comment -

Yes, I looked over CLJ-971 and can confirm this matches my observations regarding why this is happening.

Show
Sean Shubin added a comment - Yes, I looked over CLJ-971 and can confirm this matches my observations regarding why this is happening.
Hide
Sean Shubin added a comment -

My solution is a bit different in that it still tries to get the date of the file rather than defaulting to the date of the entire jar. I don't have a solid enough understanding of the calling code to know if this is important.

Show
Sean Shubin added a comment - My solution is a bit different in that it still tries to get the date of the file rather than defaulting to the date of the entire jar. I don't have a solid enough understanding of the calling code to know if this is important.
Hide
Alex Miller added a comment -

FYI, to consider your patch, I would need you to sign a Contributor Agreement - see http://clojure.org/contributing for details. I do think that is an area that something is needed, will need to assess the options a bit more.

Show
Alex Miller added a comment - FYI, to consider your patch, I would need you to sign a Contributor Agreement - see http://clojure.org/contributing for details. I do think that is an area that something is needed, will need to assess the options a bit more.
Hide
Sean Shubin added a comment -

Sure thing, I just signed and sent a Contributor Agreement, per the instructions at http://clojure.org/contributing

Show
Sean Shubin added a comment - Sure thing, I just signed and sent a Contributor Agreement, per the instructions at http://clojure.org/contributing
Hide
Gus Heck added a comment -

This effects the one-jar-gradle plugin too. Any progress on reviewing Sean's patch?

Show
Gus Heck added a comment - This effects the one-jar-gradle plugin too. Any progress on reviewing Sean's patch?
Hide
Sean Shubin added a comment -

Gus, I suggest moving this conversation over to CLJ-971.

The main problem is that I had not time to get it under test coverage, see Stuart Halloway's comment regarding that on CLJ-971. I have been pretty busy with my other projects, and being that I am not familiar with the clojure code base, I am going to have to block out some time to figure out how to get the appropriate tests in place, perhaps I will have some time for that next weekend.

Show
Sean Shubin added a comment - Gus, I suggest moving this conversation over to CLJ-971. The main problem is that I had not time to get it under test coverage, see Stuart Halloway's comment regarding that on CLJ-971. I have been pretty busy with my other projects, and being that I am not familiar with the clojure code base, I am going to have to block out some time to figure out how to get the appropriate tests in place, perhaps I will have some time for that next weekend.
Hide
Alex Miller added a comment -

Same issue as CLJ-971, which is farther along in the process.

Show
Alex Miller added a comment - Same issue as CLJ-971, which is farther along in the process.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: