Eclipse classpath not showing IVY dependency tree. Is there a workaround? - java

For some reasons outside my control the project I am working on uses ivy.xml for buildtime dependencies and we have a separate runtime.xml ivy file for use when running up a service in eclipse. This is done by created a new runtime configuration and then adding the runtime.xml via the Advanced option on the Classpath tab of the launcher.
This works fine and the application runs up without any problems. The one major annoyance, is that having added runtime.xml the classpath view of the launch configuration just displays Ivy and does not provide a tree structure view like you get in the Project Explorer view (see screenshot below). This makes it impossible to quickly view the resolved dependencies for the runtime configuration.
We are on eclipse Kepler and I appreciate it is an older version, but was wondering whether:
There is a workaround?
This may have been rectified in a later version?

Related

Package accessible from more than one module in Eclipse RCP

I updated an Eclipse RCP Project from Eclipse 2019-12 to 2020-03. After the update I get build errors on export, like the following:
"The package javax.xml.parsers is accessible from more than one module: , java.xml".
I am using Java 11, no module-info.java file, the Eclipse 3 Compatibility Layer and the eclipse product export wizard in my project.
The error message basically is clear to me. It detects some class twice on classpath, which is not allowed. Once the class is provided by JDK module "java.xml". The second copy comes from javax.xml osgi bundle.
My problem is that both of the packages can not be removed. The JDK module has a lot of dependent JDK modules that are actively used in code and I don't think that they can be supplemented by some libraries. The OSGI bundle is used by a lot of very basic eclipse bundles. So it can also not be removed.
So I have two questions:
Why does Eclipse RCP break projects with its new version? Was that considered a bug before? (I did not find a ticket)
How can I get my project to run again without really big changes?
Edit 1: Added reproducible example:
https://workupload.com/file/wKUZTXJXsR9
Edit 2: See also Eclipse Bug Ticket:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=562761
I created a minimum example. One can see the problem by exporting the product via wizard. I used DocumentBuilderFactory from javax.xml in Application.java to trigger the problem.
I found out a few things:
A plugin dependency to org.eclipse.help.ui is needed to trigger the problem. Although also other plugins have dependencies to javax.xml plugin.
Eclipse tells you the problem in Editor if I you add a direct dependency to javax.xml plugin. But we have only a transitive dependency to it and therefor get no hint.
That raises some new questions:
It seems that org.eclipse.help.ui plugin causes the problem, but we need it in our application. Is this a possible bug? Are there alternatives?
Why does eclipse editor not show the problem if I only have a transitive dependency to javax.xml plugin? Also a possible bug?
I found a workaround for this problem: When using a target definition (*.target file) instead of the Running Platform (automatic target definition of the Eclipse IDE) the error does simply not occur! I don't know exactly what the difference is between these two targets, since they both contain the "javax.xml" bundle. But when using the target file the "javax.xml" bundle is not added to the product file when automatically adding the dependencies and it does not complain later on that this bundle is needed "javax.xml". Somehow when using the target file the "javax.xml" is simply not needed and then no error occurs.
I think there is a bug in Eclipse RCP, that causes this problem when using the Running Platform. But I suggest using a target definition file anyways, since this brings a lot of other advantages.

How do Maven and m2e-Eclipse-Plugin cooperate

I have some questions about the m2e-Eclipse-Plugin. Version of m2e is 1.6 and the version of Eclipse is 4.5 (Mars).
In my Eclipse-workspace I have a Maven-Project (Java web application) that is deployed on a local Tomcat server.
I really would like to know how m2e-Plugin and Maven work together. If I change a Java-file and save it, the corresponding Class-file in the mvn-target-directory is immediately updated.
Is this compilation done by the default Java-Builder in Eclipse or is it done by Maven ? (i.e. the mvn-compile-plugin does the compilation). If the latter case is true, how is the compile-goal executed ?
Can I configure which mvn-goals are executed if a Java-file is changed and saved? If the compilation is done by the Java Builder, how does the Builder know that it has to copy the compiled
file to the mvn-target-directory
?
I found two posts:
How do Java and Maven builders work together in eclipse?
How do I start Maven "compile" goal on save in Eclipse?
that deal with similar issues. But most of the proposed configuration settings didn't work in my Eclipse.
The compilation in your scenario is done by the Eclipse compiler and not by Maven nor the maven-compiler-plugin. M2E Maps all things to Eclipse internals to handle most of the things needed to work inside Eclipse.
During an initial import of a Maven project into Eclipse using M2E (creating .project/.classpath/.settings) the life cycle will be run till generate-resources and therefore some plugins are run and can create other stuff (things like ANTLR/JAXB generators etc.).
Eclipse handles the correct target folders by reading the pom.xml files and by M2E it is translated into configuration for Eclipse etc. The things you are referencing about configuration is simply not working cause those posts are too old...

Breakpoint not registered in eclipse in maven multi-module web application

I'm currently working with a maven multi-module application in eclipse.
In some classes I can set breakpoints, and after starting tomcat (via eclipse) in debug mode, they get registered (meaning, a small tick icon is displayed next to the blue round breakpoint icon), and the debugger stops there.
In some other classes, the breakpoint is not registered, and the debugger doesn't stop there.
Why? And what's the mechanism underneath, like, are breakpoints only registered for classes that were already loaded? Or how does that work?
Update:
Using Eclipse 4.5.2 under Linux, Tomcat started under Oracle Java 1.6.0_45
It is hard to provide answer for such generic issue... however here are some hints. Let's assume the structure of your multi-module is following:
foo-project (parent, POM packaging)
foo-library (JAR packaging)
foo-webapp (WAR packaging, depends on foo-library)
Now from Eclipse's point of view, you have 3 "separate" projects. You are running your foo-webapp on Tomcat and that is what you are debugging. If you place breakpoint inside foo-library that is a different project, potentially unconnected to foo-webapp.
So what you need to do is to make sure your foo-webapp has project dependency on foo-library so that Eclipse knows when you run one project, the other is used as well. This is usually done manually automatically but by the m2e plugin. So I hope you are using that and not the obsolete maven-eclipse-plugin. Next thing you should make sure is that your dependency is correctly defined in the pom.xml... if the required version is not the same as the version of the library, m2e might link you JAR and not the project itself. And last not least you need to Enable Workspace Resolution for m2e to actually start connecting projects.
If you are sure all the things above are correct in your case, you might try to update the project according to the POM via Right click on project > Maven > Update Project....
When everything is in place you should see your project dependencies under Maven Dependencies in your Java Build Path tab.

Why can I not access all plugins in my target definition?

I have a problem concerning target definitions in Eclipse. I want to use plugin version 1.0.0, which is in my target platform definition, while I have the plugin project in my workspace with version 1.0.2. For all other plugins in my target definition, everything works as expected (which I see because an error gets flagged if something's missing), but this specific one, Eclipse does not make available to my projects. Only the plugin version 1.0.2 is. The plugin is not set as a singleton.
Why is this and how can I resolve this problem?
I figured out that I can access the right version when I close the project that contains the wrong one - but this is awkward, is there another way?
It seems that it's actually not an eclipse-specific problem, it fails also when building on the command line through maven/tycho. Specifically, my target platform is the Juno Release. Are there plugins that, while part of a feature, are not made available to other bundles? I know the plugin is there, but neither tycho nor Eclipse want to make it available to me.
Maybe I should also say it fails at compile time.
While, as I said, there exist workarounds for the problem, I still would like to have a "nice" solution to this problem. You can check out the project together with the target definition at https://github.com/kutschkem/Jayes
You may also need to check out and build this project first:
git clone http://git.eclipse.org/gitroot/recommenders/org.eclipse.recommenders.git
After setting the target platform, try building something with Jayes 1.0.0 (which is in the target platform) instead of Jayes 1.0.2 (which is in your workspace). You can also try to build with maven, it doesn't work as well.
Known workarounds:
Close the Jayes 1.0.2 project. Then, eclipse lets you use Jayes 1.0.0
For running an (OSGi) application, you can choose which bundles are loaded. You can choose version 1.0.0 manually there
Using a product definition, you can access the same runtime configuration as for workaround 2
If someone finds a workaround for maven, I'd be happy to know about it.
Maybe you have set your plugin to be singleton, so there will only be one instance for the bundle with a specific id.
You can change this by remove the "singleton:=true" in your MANIFEST.MF.
Bundle-SymbolicName: org.eclipse.xxx; singleton:=true
Or, you could remove the 1.0.2 version plugin from the run configuration when start running. click run --> run configuration to open the run configuration dialgo, switch to 'plugins' tab, here you can select which of these plugins you want to use .
I think you have already tried the following, but a reload of the target platform might help.
Also, what does your feature.xml file specify for version of that plugin?

cannot run osgi bundles outside eclipse

I am making my firsts steps using osgi and I have a problem with a bundle I created.
I developed 3 bundles in eclipse (they are plugin projects). When I run my bundles inside eclipse using a new and empty target, they work very nice.
Then I tried to export them and run them without eclipse I ran with problems. I created a jar file for each one of them (using export ->deployable plugin) and then I install them in a running equinox container (v3.7.1, from eclipse's plugin directory) and I got a lot of ClassNotFoundExceptions for RuntimeErrorException
this looks like a classpath issue. I think I am not exporting the bundle correctly, but I am not sure.
The problem only happens with 2 of the bundles, which use additional libraries
how can I do it correctly?
In case you need it, this is the full stack
Taking one of the exceptions for example: NoClassDefFoundError on javax.management.RuntimeErrorException.
Did you import the package javax.management in your bundle?
See the following page from the OSGi Community Wiki, it seems directly relevant to your problem: http://wiki.osgi.org/wiki/Why_does_Eclipse_find_javax.swing_but_not_Felix%3F

Categories

Resources