Are there any Java-compilers that leverage an OSGi-environment instead of using the classpath?

孤人 提交于 2019-12-08 11:46:22

问题


Are there any ways to make javac use an existing OSGi-environment for the resolution of build-time dependencies instead of setting the classpath explicitely? I know I could write an OSGi-component that uses the Compiler-API of the JDK, but I think there should be a more straightforward solution.

Alternatively, if no such extension is available for javac, does ejc allow such a thing (usable from the command line; I'd be willing to accept an Equinox-only solution with ejc)?


回答1:


ant task to compile using osgi.

http://www.ohloh.net/p/osgijc

or here now I guess?

http://code.google.com/p/eclipseosgitools/




回答2:


Have you considered using Maven to manage dependencies? There are plugins available for IDEs like Eclipse. You just need to map the resource servers, and the needed libraries in a pom.xml, and that is pretty much it.

-Jay




回答3:


You're missing out on the one obvious Java compiler that follows OSGi rules - Eclipse.

You can use Eclipse's compiler to do a headless build, but be warned, it's not for the faint-hearted.

Here's a simple tutorial on building with Eclipse and ant.

If you go down this path, I'd suggest looking at Tycho (the Maven sub-project for building OSGi stuff) and Buckminster, an Eclipse project.




回答4:


I'm developing in the Lotus Expeditor Toolkit and Eclipse Plugin - It's a no-charge download. My build time and runtime classpaths are managed very easily by entries in the Manifests.

[disclaimer: I am an IBM employee.]



来源:https://stackoverflow.com/questions/1379457/are-there-any-java-compilers-that-leverage-an-osgi-environment-instead-of-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!