简体   繁体   中英

how to export java project with external jars already included

I have created a java project using eclipse and in that project I have included a few jar files such as sqljdbc4.jar, jtds-1.2.4.jar, and log4j-1.2.17.jar. I have also included a dll for windows authentication in this project. I'm attempting to export this project as either a .zip .tar etc so the project can later be imported by someone else and work with the project.

I want to export the file in a way that the other developer can import the project and instantly begin working without having to download the jar files that the project is dependent on. Is this possible at all

I have already tried what i have thought would have worked going to export -> Archive file -> save in .zip format. I was unsuccessful with this I also figured going to properties -> Order and Export tab and selecting the needed jars would work and then exporting still unsuccessful.

Once the other developer imports the project the jars are not there for him...

I would use Ant. It is integrated right into eclipse and takes an .xml file called build.xml . It works by specifying "targets" in the xml file that each perform some action such as "build" (ie run javac ), "deploy" (ie run the jar command), etc. There is a command that can be called from within the jar target called zipgroupfileset which you can use to package all of the jars within your main jar file.

More info about ant can be found here

There are many variations on the following but the basic idea is to use a code library and share the project. The repository can be local to you or even better put it on an http server ( ala VisualSVN or google or the like ).

1st (local) solution:

Install SVN ( http://subversion.apache.org/ )
Install SubVersion
Create a repo on your local file system
Share the project
Dump the repo 
Send the repo
Load the repo (Other developer)

2nd (network) solution (using google code as your library)

Install SVN ( http://subversion.apache.org/ )
Install SubVersion
Put your project on GoogleCode (http://code.google.com/)
Other developer gets project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM