Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out how to let modules use external JARs without modifying core/janeway build files #8

Open
fracture91 opened this issue Apr 10, 2013 · 0 comments

Comments

@fracture91
Copy link
Owner

Modules may need to use some external library in the form of a JAR file. While talking with Chris, we tried merging an external JAR with the module JAR such that all .class files are in the same JAR (just like Janeway includes Gson). This didn't work, we got a NoClassDefFoundError when Janeway tries to load the module.

This looks like what we were trying to do, but it didn't work: http://www.knowledgetip.com/index.php/home/software-development/1-java/42-externaljarsant

I think what's happening is that the module is compiled with the expectation that the external classes will be found in the external JAR that's on the classpath at runtime. Possible solutions:

  1. Just get the external source, copy into your src directory, that should work (obviously not feasible for some libraries)
  2. Copy .class files from external JAR into build directory before running javac. Don't include the external JAR on the classpath. Maybe when javac runs, it will just "link" against the existing .class files in the build directory?
  3. Maybe the original solution is wrong in some subtle way (maybe we need some way to say "you will find the .class files from the external JAR sitting next to you in the same JAR at runtime")?
  4. Modify how modules are loaded in Janeway - maybe something is subtly wrong there, or we need some way to explicitly load dependencies.

At the moment, it seems like the only solution is to include the external JAR in the same way that Janeway includes the Gson JAR. This breaks modularity and requires developers to modify the Janeway buildfile, but it's the fastest way to get something working for Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant