Some time ago, I created a project with multiple OSGi plugins. Today I reinstalled Eclipse for RCP and RAP Developers, imported the project, and discovered that some errors are occurring in the plugins. Specifically, the org.osgi.* path can't be referenced:
Does anybody know, why this reference errors are occurring and how to resolve them?
The project must be missing the required OSGi core dependencies on its classpath. There are two ways to resolve this:
Make sure the project is created as a plugin project, and that the MANIFEST.MF exists. There should be a project creation wizard that allows you to create the project as an Eclipse plugin.
If you use Maven in your project, the best way to manage your RCP projects is to use Tycho. It helps automatically resolving plugin dependencies and building your project (even from the command line) and is a much better solution for the long term.
Maybe you are missing the target platform setup. This is where plugin projects get their build time dependencies from.
Related
This is the situation as best I can describe (I didn't create this project, so I can't say why it was done this way).
I have 3 projects:
SupportProject_A
SupportProject_B
MainProject which is dependent upon both support projects (in required projects in the build path).
SupportProject_A has SomeJar1.0.jar
SupportProject_B has SomeJar2.0.jar
The name spaces and class names are the same in both version of SomeJar, but the class definitions differ. This is causing havoc because eclipse is complaining that SomeClass.method does not exist, which it does in SomeJar2.0.jar, but not in the 1.0 version.
Is there a way, in MainProject to say, ignore SomeJar1.0.jar from SupportProject_A?
Use Dependency management system like Maven or Gradle (Gradle is my fav though). You get the plugin for both in eclipse. Once you figure out which one suits your requirement, find out which jar version is suitable for both the projects and add that to the build.gradle file along with the repository that has these versions. You should be able to setup the whole project with gradle and gradle takes care of the rest!! Good luck.
Eclipse used to build projects? It's so 2001.
But, anyway. There is two options:
1) Use one version of the library for every project.
2) Use maven.
My choice would be to use maven as relying on IDE to build your project is a bad practice.
I imported my existing maven projects under eclipse.Once imported i found under Java Build Path > Source resource foulder is
excluded(i can see Excluded:**) from build and does not get copied under target > classes directory.
I can remove exclusion manually by selecting Excluded:** and then click Remove, But there are large numbers of projects. Is there
a setting in eclipse where i can do it one go ?
That's part of what Maven does when you let it generate your Eclipse project settings (via the eclipse:eclipse plugin/goal). It's quite misleading. However, if you have the m2e plugins installed into Eclipse it coordinates things correctly.
What's going on, as best as I can figure: Eclipse's built-in Java builder automatically copies non-Java files found on the build path to the output location (unless they're excluded as you see in your Build Path). Problem is, when Maven comes in the picture it, too, wants to copy resources during a build. So to keep the two builders from competing/interfering with each other, Maven instructs Eclipse to ignore resources so it (Maven) can manage copying them during a build.
m2e integrates into the Eclipse build process to do the Maven copying of those files, so if you configure the project as an m2e project things will "just work," both in Eclipse and if you build from a command line.
I don't know of a way to tell Maven to not configure the project this way. To be honest, that's just one of the reasons I prefer to not let Maven generate my Eclipse project files; I do a much better job of it and I totally control the specifics rather than relying on whatever the Maven eclipse developers think is best.
This is an old question, but I've been looking for the answer and I finally dug it up myself. According to the M2Eclipse FAQ the import intentionally excludes resources. This is because Maven performs special resource handling that includes filtering.
Let Maven do the building for you. Disable automatic building in Eclipse and never build your projects in Eclipse.
This feels like a really stupid question but I haven't been able to find an answer.
I'm working on a maven project but I do most of my development in eclipse. Is there any way for me to force maven to generate all of my dependencies under target even if there are errors in the code? I set my eclipse project's build path to use the jars under target/dependencies/jars, but calling mvn clean kills them and if there are any errors in my code causing it to not compile mvn package won't create the dependencies but will instead just crash saying BUILD FAILURE. This makes the problem even worse since instead of seeing the actual errors my eclipse will just bombard me with errors everywhere since all of its dependencies just died.
Or maybe the way I'm working with it is just stupid and there's a better way.
Are you using the m2e plugins for Eclipse to process maven projects, or simply importing the projects as general ones?
If the latter, you should use the m2 plugins (simply go to the Eclipse Marketplace and search for Maven), as they interrogate your POM and set up your dependences properly. You can then concentrate on any compile errors in your code.
You should not point to the jars in the target folder for dependent JAR's since this is where the products of building your project are stored. Performing a mvn clean removes this folder.
To use Maven with Eclipse install the m2e plugin in Eclipse. This makes Eclipse understand the structure of Maven projects.
Once installed you can import your Maven project into Eclipse. I use Import... | Existing Maven Projects for this. But you can also directly import form a versioning system.
During the import Eclipse will set up the Eclipse project to use the Maven dependencies to locate the required JAR's. These are taken from the repository as configured with the used Maven installation.
Se lets say you are starting with a multi-module project. A library and two modules which will depend on that library.
I am planning on using ANT plus Ivy for dependency management. So I am looking for a way to integrate Eclipse + ant + ivy.
So the standard way of working with these tools would be to create a different project in eclipse for each module? or create a Single project and multiple src folders for each module?.
Although my question might seem like a very subjective one, I am looking for a standard way to handle multi-module projects under Eclipse when using an external tool for building and dependency management. And by a standard I mean, in a way that eclipse will find the dependencies for my project, auto complete works and src and javadoc will be available when needed inside the IDE, also that when debuging within Eclipse, the source will be attached to navigate through the breakpoints.
Please don't tell me to use Maven, I have used it already and hate it with passion.
You have IvyDE which works well with dependency management (can be Jar from repository or Ivy module in the workspace).
Each Eclipse project is an Ivy module whose dependency may be resolved from workspace (build path entry from eclipse project) or an Ivy resolver (build path entry from the Ivy cache).
For the developer workflow, I think you doesn't need Ant since Eclipse will build the projects for you, and for the CI build, the Ant script will use the same Ivy modules definition. The only difference is that at each module build, a publication will be done and you'll need something else (Jenkins?) to make dependency build trigger (which in turn will resolve their dependencies from Ivy and publish their artifacts).
There is also Ivy trigger after a publish task to trigger other project?
The Ivy buildlist task may work as well but never used myself.
I downloaded Java source code of some project that works with Maven. After checking out
the code to Eclipse, and then building it from the command line, I followed the instructions
and imported it from Eclipse as: File > Import > Maven Projects. Now I have the core source code and many additional sub projects that seem to have the same thing like the core, just separated.
Could anyone please explain me what are these sub projects? why I need them? and on which code I need to work now if I want to make changes, the core or the new imported Maven ones?
I don't know nothing about Maven besides the fact that it's a tool for building code and managing releases.
Thanks!
In Maven land, these are called modules. There a nice way to further divide a project into very distinct pieces.
People handle Maven differently. I've seen projects where there was the actual project module, then 10 or so implementation modules. Most people use them for the above mentioned separation.
Most likely, your going to need all of the modules in order to work correctly.
To modify the project, your going to need Maven. I don't know if Eclipse has an embedded maven, but at least NetBeans does. With this you can modify anything that you want, then build it with Maven, which should be just a simple click.
In addition to what #Quackstar said:
Eclipse has embedded Maven support provided by the m2eclipse plugin. When you import a Maven project consisting of multiple modules, the default behavior is to map each Maven module as a separate Eclipse project. This allows the Eclipse build paths to be constructed in a way that matches the declared Maven module dependencies.
There is also a way to map a multi-module Maven project into a single Eclipse project that entails enabling m2eclipse's "Nested Module" support. This results in an Eclipse project with a build path that is an amalgam of all of the Maven module dependencies ... and not exactly correct. This approach is not recommended by the m2eclipse developers, and I've heard they are intending to remove the nested module feature entirely in a future release.