Gradle subprojects refresh removes other dependencies - intellij-idea

I have following project structure:
rootProject.name = 'toolbox-backend'
include 'toolbox-components-executor'
include 'toolbox-components-toolsyncer'
include 'toolbox-components-toolconfigparser'
toolsyncer i.e. has the dependency for the jgit library. While trying to edit the code in the service java file I see that IntelliJ shows the resolve in red - so it isn't found.
I found out that this happens when I resolve all projects at the same time. The toolsyncer subprojects shortly resolved the dependency but gets its dependencies removed as soon as the next subprojects starts to resolved and therefore removes the jgit dependency since it does not need it.
Whats the best practise here? Declare all dependencies needed in the root project?

Related

Conflicting project in Xtext mwe2 workflow

I have a Xtext DSL that builds successfully from inside eclipse and maven and is included in a complex multi-plugin RCP application.
Yet, whenever the MWE2 workflow is executed the log is full of warnings of the form:
[INFO] 281 [main] WARN lipse.emf.mwe.utils.StandaloneSetup
- Skipping conflicting project org.eclipse.e4.core.contexts
at 'archive:file:/C:/userdir/.m2/repository/p2/
osgi/bundle/org.eclipse.e4.core.contexts/1.3.100.v20140407-1019
/org.eclipse.e4.core.contexts-1.3.100.v20140407-1019.jar!/'
and using 'archive:file:/C:/userdir/Documents/projects/projectdir/
resources/project/plugins
/org.eclipse.e4.core.contexts_1.3.100.v20140407-1019.jar!/' instead.
Some of these warnings, like the above, are about a conflict between the local .m2 folder and a project folder, while others show a conflict between two project folders.
Question:
How do I get rid of these warnings?
My guess is that the project is misconfigured somehow including dependencies to some jars twice.
Yet, at the moment I have no idea which dependencies are used by MWE2 during execution causing these warnings.
Is there any way to get an overview of the consulted dependencies or to debug this stuff?

Using Gradle with IntelliJ

We are trying to setup a number of Gradle (v1.5) web projects in IntelliJ v12.1.2
The new JetGradle integration works fine until we get the the Artifacts
The module is imported as a Gradle project, the artifact is been created as a Web Application (Exploded) and the Web facet has been added - all the dependencies that are declared in the build.gradle file are correctly added to the WEB-INF/lib directory in the artifact
The problem comes when we make a change to the dependencies in the build.gradle file and refresh the module using the JetGradle refresh button - the dependencies of the module are updated correctly but nothing is changed in the artifact
If we changing just one dependency then the change can be done manually but if there are a number of changes or there are a lot of new/changed transative dependencies then it seems the only timely way to get the correct dependencies in the artifact is to delete and recreate it
Am I missing something obvious, does anyone know a better way to update the artifacts
Thanks
Automatic artifact config update is not implemented yet. I've created corresponding ticket for that - http://youtrack.jetbrains.com/issue/IDEA-109369

Eclipse RCP: Dependencies correct (?) but get a NoClassDefFoundError

I have a RCP project where I cannot fix a NoClassDefFoundError: One plugin depends on another plugin. The plugin-dependencies are set in the manifest, packages exported, and there is no error at compile time. Both plugins are in the product dependencies and visible in the installation details of the product.
But when I run the application I get a java.lang.NoClassDefFoundError when the one plugin wants to use a class from the other plugin.
Any hints how to find the reason for this are greatly appreciated.
Thanks,
Michael
I found the problem: I created the plugin which could not be loaded from an existing Java project. And somehow I deleted the "." in the entry Bundle-classpath in the plugin manifest (the plugin has some jars which -> so lib/xyz.jar was in the Bundle-classpath entry but not the ".").
For the class-loader of the bundle the "." means to search for classes from the root path of the bundle (or something like that), so it could not find the classes. However, there were no errors in the IDE so it was hard to find.
Is the configuration for running the application correct i.e. all dependencies are also put in the running configuration?

M2Eclipse can't find dependencies when they are projects in the same workspace

I know there are various known issues with the M2eclipse plugin and I guess this is just one of them. Hopefully someone is aware of a solution or workaround.
We have like 30 projects in our workspace but for clarity lets assume there are only 2: A en B.
B includes A as a dependency in the pom.xml of B.
The problem we have is that in eclipse the classes of A can't be found so you get compilation errors. However, if you 'mvn install' A to deploy it in the local repository and the close project A then everything is fine; no compilation errors. So, if A exists in the project M2Eclipse does not seem to be able to correctly set the classpath in eclipse.
To make things stranger, we also have project C that also depends (in exactly the same way as B) on project A but here we have no compilation errors. We can't identify anything meaningful difference between project B or C; as said, they include A in the same manner.
thanks for your help,
Stijn
P.S. I'm using version 0.10.2.20100623 of the plugin
I've experienced this behavior before, and it has occurred for me in the past when I imported or checked out the maven projects separately.
Prerequisite: make sure you have m2extras installed before you check out a multi-module Maven project: update site
First thing to try: right-click each project and choose Maven -> update project configuration. The plugin might be smart enough to detect that it could be building project references between the projects.
Second thing to try (if your 30 projects are all submodules off one root): this would be easiest, because you could use the SCM integration of m2eclipse to do a "Checkout as Maven Project..." on the root pom. M2eclipse would make a project for the superpom and for each submodule, with project references built appropriately.
Third thing to try: I'd try manually creating project references in the project settings of each project to mirror their interdependencies. It'd be a lot of work, and unless you check in your eclipse .project/.settings (eww), it would have to be done individually for each working copy.
RESOLVED
finally, after agonizing hours I found the cause.
I was focussing on the .classpath and the .settings files but the problem was located in the .project file. This file in project A was missing following entry in the tag natures:
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
Adding this resolved the issues.

Resolving maven dependencies

Inovking maven2 goal mvn dependency:list on an artifact pom causes to download the whole dependent artifact packages. I think only those pom files are necessary for resolving dependencies. Aren't they?
On the dependecy plugin documentation you can read that dependency:list is an alias for dependency:resolve. What you need is dependency:tree which :
Displays the dependency tree for this project.
Even with dependency:tree you will have to download dependencies.
From Arnaud Héritier (developer on Maven Project)
This is a problem in maven core which doesn't allow in 2.x to resolve dependencies without downloading artifacts.
Each mojo (plug-in in the Apache Maven) has a functionality description. See all dependency plugin functionality.
I am working with the current edition of Maven (the plug-in that shipped with Eclipse Neon), and I'm still working to get my head around how to make it do all the magical things it is claimed to be able to do.
I have the screen pictured below, in which the dependency highlighted in the left pane is unresolved.
!Dependency tree, showing missing dependency1
I thought that selecting (executing) the Update Project item off the project's context menu, as shown in the following image, would resolve it, but it left me with three errors, all, one way or another, the result of a missing dependency.
!Maven fly-out menu in project context menu2
By examining the file system, I have confirmed that the dependency is, in fact, absent.
Color me confused; why didn't that action download the missing dependency?