简体   繁体   中英

How to configure Eclipse for building external libs-requiring Java apps?

I want to use several standard third-party libs (eg Apache's log4j) for a small Java project I'm working on. I know how to configure my IDE, Eclipse, so that these libraries are available during my development work, but I don't know how to build the distributions for my app so that, when necessary, these external libraries get properly installed in the target system.

One approach I have seen is to treat these external libraries as if they were internal to the project, even checking them into Git or subversion or whatever along with the code that is truly being developed.

What I most dislike of this approach, at least for what I'm working with at the moment, is that the total disk footprint of these external libraries more than 10x the footprint of my app proper (which, as I said, is pretty small and simple).

Is there a better approach?

PS: I've heard about Maven and that it's supposed to handle these issues, but it looks like overkill for the relatively small and simple project I'm dealing with here.

I haven't built a java app in years without maven. No matter how big or small, having something manage dependencies for you is great. The dependency plugin is awesome for when you actually want to deploy to an end server and need to get all of your deps local. I don't think any project is too small for a simple POM file.

In all fairness, your question is not really about Eclipse but about project distribution.

The plain vanilla solution, as you said, is to include those jars with your project in svn/git.

Maven indeed can help, and it also has good integration with Eclipse too, natually, to ease the deployment cycle.

I agree with you that Maven might be an overkill. For a middle ground solution, I'd look at ivy instead, and maybe gradle too. There is a truly awesome presentation titled "your next successful build" about this topic here .

Maven is great and all until you need to start doing development with others and not having a maven repository that everyone can access. This only becomes a problem when you create a module that your current project depends on and they than need to incorporate that dependency into the setup.

Without having a maven repository to push these changes to it can get messy.

If this is only a project you are working on, or internal to your company than maven might be a good idea or if you are only using third party libraries that are already available in public maven repos.

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