#7 Replace/shade main by One-JAR artifact


I would like to be able to use my One-JAR artifact as the main artifact in Maven. Can I achieve this today? I am not sure, but I guess not - thus the feature request.


  • P. Simon Tuffs

    P. Simon Tuffs - 2013-03-19

    I'm not a maven expert, though I am no maintaining the maven side of one-jar. I'm going to try to translate what you ask into what I think you asked:

    "can I build a one-jar, deploy it to a maven repo, then advertise it and have others pull it (with all its embedded lib file) and build against it." I would guess that my knee-jerk answer would be "no", because the class files in embedded one-jar library and main jar files are not visible in the jar to a normal compilation process. There isn't a solution to this that I'm aware of, though I did start to experiment with running the java compiler as an in-process call to the JDK compiler support tools at one point, which would potentially let it see inside the one-jar files using the classloader trickery. But I didn't get very far with this.

    I'm happy to open up a discussion with you on this if you can provide input, and best if you can engage with the project to help me out with the mavennish things.


  • Alexander Kriegisch

    Hi Simon.

    Thanks for trying to translate, but what you suppose is not what I asked or what I need. It is much simpler. At the moment the main artifact of my build is a JAR containing my application classes (a simple, stand-alone Java SE program). Additionally I attach a One-JAR including all library dependencies for my users' convenience. Actually I do not need the main JAR, but just the One-JAR. I want to replace the former by the latter as the main artifact, semantically "overwriting" the former by the latter, because the One-JAR is all I care about. At the moment both artifacts get deployed though. I want the One-JAR to be deployed *only*, but under the name of the original JAR (without the "onejar" attached to the file name).

    Is this explanation more understandable?


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks