How to create an Eclipse plugin with an external jar using Ant build

I wrote an eclipse plug in and built it from a batch file using Ant.

Now I have written a small java application (jar file) that I need to use as an external jar, from my plugin code.

I googled a lot and did the following: (Since I am building it via batch file and command line, I am not writing here how to do it using Eclipse UI, but command lines)

  • In MANIFEST.MF I added the following lines:
Bundle-ClassPath: libs/DataManager.jar,
 .

      

  and I remembered to add two empty lines, as needed...

      

2. In the .classpath file I added the following lines:

<classpathentry exported = "true" kind = "lib" path = "libs / DataManager.jar" / ">

  1. I edited the build.properties file so it now looks like this:

    source .. = src /

     output.. = bin/ bin.includes = META-INF/,\
                    .,\
                    plugin.xml,\
                    icons/,\
                 libs/,\
                    libs/DataManager.jar              
    
          

    src.includes = libs / jars.extra.classpath = libs / DataManager.jar

  2. My build.xml file contains the following line:

<target name = "Bin" depends = "init, @ dot.nestedJars" if = "Bin" description = "Generate jar: com.ish.epish @dot." >

< delete dir="${build.result.folder}/Bin"/>
< mkdir dir="${build.result.folder}/Bin"/>
    <path id="@dot.classpath">

      

<pathelement location = "libs / DataManager.jar" / ">

Now, build the command line:

java -jar "C: \ Eclipse, \ 4.3.2 \ Plugins \ org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar" -application org.eclipse.ant.core.antRunner -buildfile "% CD% \ com.ish.epish \ build_temp.xml "

the state is that the jar was created successfully, but it fails at runtime and I don't know why. in addition, when I try to see the contents of the jar file using the BeyondCompare software, I see that the "libs" folder that I wanted the jar to contain is not part of the jar.

I should note that when I do all this through the Eclipse IDE interface - the process is easy and correct, but I have to do it through the command line ...

Can you help me?

+3


source to share





All Articles