How to add dependent jars to deploying plug-in - eclipse-plugin

I would to like to add the dependent jars to the update site plugin project in Eclipse.
I followed
http://wiki.eclipse.org/FAQ_How_do_I_create_an_update_site_%28site.xml%29%3F
but, it does not address the above issue. How to deal with the dependent jars with deploying plugin? Anybody please help with ideas.
Thanks

I'm going to assume you are wanting to add additional Jar files to your plugin. You can do this by simply putting the Jar files into the top level directory of your plugin, and in the Classpath portion of the Runtime tab in the Plugin Manifest Editor you can specify the Jar file. This will automatically add it to the build path as well.
Some people prefer to make an extra plugin that contains nothing but external Jar files; you add the Jar files to this extra plugin the same way and then just use the Dependencies tab in the Plugin Manifest Editor to make your original plugin dependent on the Jar plugin.

Related

How to export a dependecy or jar package at runtime?

I want to export a package from an embedded jar from my plugin. Like, MyProject/folder/myJarName.jar packages from my current plugin. For this I tried using apache felix and exported package, specified the location of the jar in bundle classpath. But, when I build my project, it manifest file complains that, package 'com.demoName.package' doesn't exist in this plugin. Is there any way to achieve this.
To export your project jar packages to the external plugins, need to do the following.
Add your jar file in the plugin.xml classpath section, that you can
find in the Runtime tab - This will make your jar available at run-time.
And in the Exported packages section, add the required packages
which you wanted to export- so that, other plugins can also access these packages.
Please find the below screenshot. I've added httclient.jar in my project lib folder and made it available to the run-time through Classpath.

How Add jar file to eclipse plugin?

I want to write a plugin in eclipse that sends active window title to a port when active window changes. For this purpose I have to add jna and jna-platform-win32 libraries to my plugin. This libraries add in compile time but when I want to use them in run time libraries not worked. How can I solve this problem in eclipse?
You must add the jars to the Bundle-Classpath in the plugin MANIFEST.MF and also include them in the 'build.properties' file so they are included in the plugin build.
To add to the Bundle-Classpath open the plugin.xml editor and go to the 'Runtime' tab. Add the jars to the 'Classpath' section (you should also have a '.' entry for your normal plugin classes).
The 'Build' tab of the plugin.xml editor updates the build.properties file so make sure the jars are checked in the Binary Build section.

Adding Jar files to IntellijIdea classpath

I have created a new Intellij project. But I can't use the third party jars in my project. I have the jars in a directory structure as follows:
repository/commons-logging/commons-logging-1.0.4.jar
repository/commons-lang/commons-lang-2.1.jar
etc.
I want to add them just by pointing to the repository directory, but couldn't find any ways to add them.
But when I am using classes or API from that jars, the editor can't resolve the classes.
I have tried from Project Structure but can't configure it.
Go to File-> Project Structure-> Libraries and click green "+" to add the directory folder that has the JARs to CLASSPATH. Everything in that folder will be added to CLASSPATH.
Update:
It's 2018. It's a better idea to use a dependency manager like Maven and externalize your dependencies. Don't add JAR files to your project in a /lib folder anymore.
If, as I just encountered, you happen to have a jar file listed in the Project Structures->Libraries that is not in your classpath, the correct answer can be found by following the link given by #CrazyCoder above: Look here http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html
This says that to add the jar file as a module dependency within the Project Structure dialog:
Open Project Structure
Select Modules, then click on the module for which you want the dependency
Choose the Dependencies tab
Click the '+' at the bottom of the page and choose the appropriate way to connect to the library file. If the jar file is already listed in Libraries, then select 'Library'.
On the Mac version I was getting the error when trying to run JSON-Clojure.json.clj, which is the script to export a database table to JSON. To get it to work I had to download the latest Clojure JAR from http://clojure.org/ and then right-click on PHPStorm app in the Finder and "Show Package Contents". Then go to Contents in there. Then open the lib folder, and see a bunch of .jar files. Copy the clojure-1.8.0.jar file from the unzipped archive I downloaded from clojure.org into the aforementioned lib folder inside the PHPStorm.app/Contents/lib. Restart the app. Now it freaking works.
EDIT: You also have to put the JSR-223 script engine into PHPStorm.app/Contents/lib. It can be built from https://github.com/ato/clojure-jsr223 or downloaded from https://www.dropbox.com/s/jg7s0c41t5ceu7o/clojure-jsr223-1.5.1.jar?dl=0 .

Add all jars in a repository as dependencies in IntelliJ

I have a savant repository in my project and I want to add all of the jars contained within the repo to IntelliJ's depenedcies list. I can add the jars one at a time, but I want to be able to add them all at once.
Is there a way to add all the jars found within all the directories/subdirectories?
Details: IntelliJ 12
Update: I can not change the repository structure, it is auto populated when ant builds.
Adding jars from a directory is supported, but not recursively, please vote for this feature request.
Yes, you can add all jars in a folder.
You have to create a library and select option: "Attach file or directories" and the select a directory.
This way even a future changes to the directory will be visible.

How to generate a jar from a java module in IntelliJ with the dependencies placed in a separate directory?

I have a module for which I want a jar to be created. So, here is what I do:
Adding a jar artifact, using the "From module with dependencies ..." option
In "Jar files from libraries" I select "copy to the output directory and link via manifest"
Leave all the defaults.
After that I can build the jar and all the dependencies would be placed near it in the same directory. So far so good.
Now I wish all the dependencies to be placed in a separate directory near the final jar. So, I repeat the same steps, but this time I create a new directory under the node in the artifact Output Layout tab (using the "Create Directory" button). Next I drag all the dependencies onto the new folder and apply the changes.
On the surface, everything is cool - the dependencies are indeed placed in the dedicated directory, but the MANIFEST.MF file is never updated! It should reference the dependencies via the new directory. As of now, the produced jar cannot be run - its dependencies are not visible.
This is unlike Eclipse, which does make sure the manifest file is correct when exporting a project as jar.
How can I workaround this problem, given that:
I want all the dependencies in a dedicated folder.
I want to use IntelliJ IDEA
I do not want to edit the manifest file manually.
I am using the latest download of the IntelliJ IDEA for windows - 11.1.2, build 117.418
Thanks.
At the moment you have to update the classpath manually in the artifact configuration dialog so that it includes the subdirectory:
I've created an issue for this limitation, please star/vote.