简体   繁体   中英

Any tutorials instructing how to use Maven artifacts of Eclipse in a standalone manner?

As far as I know, with the exception of SWT, most Maven artifacts of Eclipse rely heavily on an OSGi environment and thus cannot decouple with Eclipse and cannot be used in a standalone manner. If striving so, you'll end up with implementing a desperate list of interface methods that eventually may deviate from your mission focus and may not work at all. I'm not sure why Tycho needs to straddle and pull artifacts from both Maven and P2 repositories. Sometimes I just want to go without Eclipse IDE. I'd like to use part of Eclipse classes as data models and even part of the methods to get needed data, instead of writing my own code to parse such files as p2.index , content.jar , and artifacts.jar . Artifacts of SWT on Maven are able to go without Eclipse.

Most online tutorials teach you how to write plugins and RCPs inside Eclipse IDE but how about developing a standalone application parsing P2 repositories, identifying dependencies and fetching needed artifacts and features in my own way in place of the P2 way, with the help of dependencies from Maven and built-in Java libraries? Are there any systematic tutorials or documentations instructing so?

Sometimes I just want to go without Eclipse IDE. I'd like to use part of Eclipse classes as data models and even part of the methods to get needed data, instead of writing my own code to parse such files as p2.index , content.jar , and artifacts.jar .

Yes, you can. However, as @greg-449 put it, "That would be enormously difficult." The reason is that these classes are loaded with their respective ClassLoader (container) associated with the package where they are in, which is to say, the class of a Maven artifact of Eclipse a plain Java program initializes will be viewed by the JVM as different with the counterpart in the running OSGi environment, despite their identical full name, so casting is not possible. You'll need to use reflection mechanism of Java to manipulate OSGi classes to get data or do jobs in a plain Java program.
It will be a brain twister, since you are going to go without advanced grammar check from the IDE, and write lots of additional lines of codes to mimic the original features. The classes you deal with all the time are Class, Method, Parameter, etc.. The exception you deal with all the time is NullPointerException. You'll get crazy with which package the class is in, which ClassLoader to use, and how to construct parameters for the class constructor / methods to work.

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