I've attached an image of what JRuby.jar contains:
http://www.freeimagehosting.net/uploads/fbfd966375.png
The problem is that even for simple scripts, the resulting jars have about 8mb. Can you tell me which folders I could remove from there, and still have it running ... or what's the purpose of some of that folders?
You could try repackaging the jar with pack200 if you just want a better compression ratio.
JRuby does bundle all its dependent Java libraries, so it won't be easy to trim those back. Stay tuned or follow progress on JRuby for Android for a more minimal jar.
Related
My problem is similar like this question:
Storm command fails with NoClassDefFoundError after adding jsoup as provided dependency
But I want to know the latest solution and better way to solve this.
I will post the same description in storm user mailing list:
Hi all,
I am building a topology with a load of libraries, such as spring, geotools, etc. Right now, I extract each jar files and pack it into one jar, (as suggested by many forums), using maven. The problem here, each jar sometime has conflicting files, so I have to merge manually. Another thing, though I pack my libraries in jar, storm loads its libraries first. For example, I use guava 16, and storm uses guava 13. My program won't work because guava 13 is loaded.
Current solution is I change the clojure script to put my jar first in the classpath before other jars. Or, I put my jars in lib/ directory.
Is there any simple and reliable way to include jar in Storm? Sorry if this email is too long. I want to make myself clear.
You can use the maven-shade-plugin instead of the maven-assembly-plugin to build your uber-jar. Then, use the relocation feature to move classes into a different package.
A little back ground: We are using Apache Felix implementation of OSGI for our web development (Adobe CQ5 which inturn is built on apache felix). We have a few bundles of our own (around 10) and each of them are configured as a project.
Issue: During the development lifecycle, we make changes to a bundle and then use an ant script to create the bundle and deploy it in the felix. I am wondering if there is some way to enable hot deployment of the changes I make during development mode that would save developers time.
Based on my research, we can use the felix file install which will monitor a folder(s) for changes to any bundles and can deploy them automatically. But this again means I need to run ant script to build the jar file and move it to the auto deploy folder the file install is watching. Is there a better/fast way to achieve this? The script is currently taking a around 10 seconds (approx) to compile the classes, create osgi specific meta data files, bundle the classes+metadata in a new jar. Is there some way to do hot deployment, so that any change I make to a java file is automatically reflected in the bundle?
Many thanks
If you develop your project in Bndtools, and run from the built-in launcher, then Bndtools will handle immediately building any Java code that you change, and deploying the updated bundle into the runtime. This leads to an extremely quick code/test/debug/fix cycle.
Having said that, I'm amazed that it takes 10 seconds to compile and build your bundles currently! Are you building on an extremely ancient computer? Or is the bundle multiple gigabytes in size?
We tried DCEVM and it does almost everything we expected to reduce the develop+fix+test life cycle. I recommend this to all java developers using big web applications. Thanks for your suggestion on bndtools Neil.
I want to set the time stamp of the classes and resource in a maven module, just before it's built into the jar.
I guess I can use the maven-antrun-plugin, but I'd like to see if there are better ideas.
Does anyone have an idea?
Let me add more details for the reason I need this capability.
When we build a new version for the product, we also build a patch install which compares all artifacts of previous build to current, and packages only the ones which differ.
Jars (and any zip based archive) might have the same content, but time stamp of classes and resources are part of the metadata, and cause the diff to show jars differ (when in fact, the content is identical). I want to hack the jar packing and set all classes times tamp to be constant (like 1/1/2000 00:00).
I hope this explains my need.
Well, the best solution is to adapt your tool that compute the diff to go have a look deeper in the jar ;)
I am afraid there is no other way than using the a ant file with the touch task to reset the file date. There is no existing plugin that sets the file date.
You could also write your own maven plugin and contribute it to the community but it is probably a bit overkill...
HIH
M.
I just want to share what I decided to do.
I will not touch the maven build, and let it build the jars as before.
What I did is implement a script in my build to compare the jars. The logic of this script is simple:
Check arguments (jars exist)
Extract jars to a temp folder (with a unique name)
Run a diff on both folders
Cleanup
Exit with the relevant exit code (0 if same. 1 if differ)
I hope this is useful.
What is the best way to create a JRuby JAR file that contains compiled JRuby code to be used in a larger Java application, especially with Maven. It seems that most of the use cases with JRuby are to build apps at the top of the stack and integrate legacy Java code. So most of the documentation and resources are around building WAR files and standalone JARs. Both warbler and rawr build standalone JARs.
We have to take a slightly different approach of putting JRuby right in the middle of the stack, so I want to build reusable JARs that can be uploaded to an internal Maven repo and use them as dependencies the same way I do with any Java code. There's not much documentation on how to do this and I've only come up with:
Write a Rake task to jrubyc compile the JRuby files and stuff them into a JAR file
Try something like buildr or gradle to do the packaging
Has anyone done this before? Any recommendations on which approach I should take or better approaches? Thank you.
I have been assigned a job to compile an old Websphere(WAS4) project, so we can find out which parts of it need to be changed for the project upgrating( to WAS7).
But when I was trying to fix the jar errors, wesphere.jar is missing!! And WAS7 installation path never hava this jar anymore, searching google failed. And I don't like to install older WAS again to just get this jar.
please anybody can help with this, providing an WAS4 version webspere.jar???
TKX in advance!
The jar file itself isn't important, the classes within it are. I don't recall what was in websphere.jar, but there's a good chance that what was is now in j2ee.jar. In fact, if your code isn't using any WebSphere-specific extensions, there's a good chance j2ee.jar is the only jar from WebSphere that you'll need for compiling.
But you should be able to see what specific classes are being complained about by the compiler and if necessary search for those by opening the jar files in like WinZip.
(Keep in mind that the larger changes are the changes to J2EE and Servlet specification levels.)