Ivy cache not updated with a compiled and published module - ivy

Module A uses module B. I compile module B which implies a new jar in ~/.ivy2/local/[group]/B/[version]/B-[version].jar.
~/.ivy2/cache is not updated.
My problem is that Module A is trying to find B in ~/.ivy2/cache (that's what IvyDE indicates).
How can I ensure the cache is updated once project B is compiled?
Regards

You may want to use the workspace resolver feature of IvyDe:
This will makes all eclipse projectes directly available, without the need to build/publish th artfifacts.
Note: The Screenshot ist for 2.2.0Beta, but the feature exists for the current version, too.

Related

How to add org.eclipse.swt (and other plugin dependencies) as an automatic Java9 module?

In order to be able to use my Eclipse plugin "treezCore" also as a Java9 module I created a module-info.java in my src folder.
Furthermore, I moved the Plug-in Dependencies from the Classpath to the Modulepath. I can see a module "org.eclipse.swt.3.106.1.v20170926" in the plugin dependencies:
However, I am not able to reference that module in my module-info.java. I tried
require org.eclipse.swt.3.106.1.v20170926;
require org.eclipse.swt;
require swt;
None of those options worked. The jar file \plugins\org.eclipse.swt_3.106.1.v20170926-0519.jar that is used by Eclipse does not contain a module definition and
jar --file org.eclipse.swt_3.106.1.v20170926-0519.jar -d
says that the module descriptor can not be derived. Also see
Unable to derive module descriptor for auto generated module names in Java 9?
If I download a newer version of swt.jar from
http://download.eclipse.org/eclipse/downloads/drops4/R-4.7.1a-201710090410/download.php?dropFile=swt-4.7.1a-win32-win32-x86_64.zip
I get following output that looks promising:
swt automatic
requires java.base mandated
contains org.eclipse.swt
contains org.eclipse.swt.accessibility
contains org.eclipse.swt.awt
contains org.eclipse.swt.browser
contains org.eclipse.swt.custom
contains org.eclipse.swt.dnd
contains org.eclipse.swt.events
contains org.eclipse.swt.graphics
contains org.eclipse.swt.internal
contains org.eclipse.swt.internal.gdip
contains org.eclipse.swt.internal.image
contains org.eclipse.swt.internal.mozilla
contains org.eclipse.swt.internal.mozilla.init
contains org.eclipse.swt.internal.ole.win32
contains org.eclipse.swt.internal.opengl.win32
contains org.eclipse.swt.internal.webkit
contains org.eclipse.swt.internal.win32
contains org.eclipse.swt.layout
contains org.eclipse.swt.ole.win32
contains org.eclipse.swt.opengl
contains org.eclipse.swt.printing
contains org.eclipse.swt.program
contains org.eclipse.swt.widgets
I also depend on org.eclipse.jface and could not find a seperate download for it.
=> Do I really have to wait for a new release of Eclipse that uses new plugin versions including module definitions?
Or can I somehow reference the old version of swt from the plugins folder, even if it does not include a module definition? I looked for an easy way to define an alias or a fallback dependency e.g.
requires ../plugins/org.eclipse.swt_3.106.1.v20170926-0519.jar as 'org.eclipse.swt'
or
requires org.eclipse.swt fallback ../plugins/org.eclipse.swt_3.106.1.v20170926-0519.jar
but module-info.java does not seem to support such a syntax.
I have about 20 plugin dependencies and do not want to manually download each of them (if it would be possible) and include them as external jar file. Nor do I want to hack the individual Manifest/jar files in the Eclipse plugin folder. There are many jar files I would need to alter and an update of Eclipse would break that hack.
I am using Eclipse for RCP and RAP Developers, Version: Oxygen.1a Release (4.7.1a), Build id: 20171005-1200
Edit
When using Version: Photon Milestone 4 (4.8.0M4) Build id: 20171214-1849, the error in module-info.java vanishes when using
require org.eclipse.swt;
and having the Plug-in Dependencies in the Modulepath.
However, my imports do not work yet, see following image. If I move the Plug-in Dependencies from the Modulepath to the Classpath, the imports work but the error in module-info.java reappears.
I created a min example at
https://github.com/stefaneidelloth/Java9EclipsePluginExample/tree/master/MyPlugin
and I filed a bug report at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=529089
Related questions:
How to use 3rd party library in Java9 module?
Unable to derive module descriptor for auto generated module names in Java 9?
Force Eclipse (Helios) to use a newer version of SWT at application runtime
JFace libraries stand-alone download (not picked from Eclipse plug-ins)
New Keywords in Java 9
What you observe is tracked in bug 525660, which starts with the observation that all existing (OSGi) artifacts of Eclipse don't work as automatic modules, because Java 9 fails to derive a valid module name from jar filenames of the shape org.eclipse.swt_3.106.1.v20170926-0519.jar.
Since this was discovered too late to request improving the algorithm for automatic module name derivation, this can only be fixed by adding Automatic-Module-Name headers to the manifests of future releases.
This header is present starting from Photon M4 as can be seen in org.eclipse.swt_3.107.0.v20171205-0742.jar, containing:
Automatic-Module-Name: org.eclipse.swt

Configuring IntelliJ Platform plugin's workspace

I've been setting up the workspace for IntelliJ's plugin development. There is one issue that I'm not able to solve.
I have two plugins: A and B. The B plugin depends on A. The A plugin is provided as an install-ready zip package (I don't have the code and I don't want to add it to my project).
In the manual, I met this page. I added jars from the A plugin (extracted from the zip file) to the SDK that is use when running B plugin. Unfortunately, when the sandbox is being bootstrapped, I get the following error:
Problems found loading plugins:
Plugin "B" was not loaded: required plugin "A" not installed.
Disable B
Open plugin manager
Does it mean that plugins from the SDK are not installed automatically?
I tried to install the A plugin in the sandbox but then I got a casting exception - two different class loaders were used.
Of course, I have appropriate dependency configuration in the B.plugin.xml file:
<depends>A</depends>
My question is how should I provide the A plugin to be able to develop the B plugin? Is it possible to develop the B plugin without A's sources?
In the jars that I added to the SDK's classpath, there is a package that contains the plugin.xml file for the A plugin. This plugin is also not listed on the list of plugins.
I'm sure that both plugins are configured properly because there are no problems when I install both of them in a standalone IntelliJ instance. Additionally, I don't have any compilation errors.
After couple more hours of debugging. The A plugin is marked as not installed because in the PluginManagerCore:loadDescriptorsFromClassPath method there are no appropriate jars URLs provided. It seems that BootstrapClassLoaderUtil doesn't include all of the entries configured in the SDK.
I tried to set -Didea.additional.classpath property, but I got the class cast exception again.
Finally, I have found the solution.
The B plugin consists of other B submodules:
B.submodule-1
B.submodule-2
B.submodule-3
One of these submodules had dependencies to the A's submodule. Something like this:
B:
| B.plugin-submodule
| B.submodule-1
| A.submodule1
| A.submodule2
| B.submodule-2
| B.submodule-3
Based on the gradle setup, IntelliJ resolved all of the dependencies for all submodules. Initially, I removed Gradle dependencies and set the JDK only for the plugin submodule. It was required to do so for the others (submodule-1/2/3).

Inconsistency between 'uses' and 'Import-Package'

I am using bnd to generate MANIFEST.MF for a library. In the end, I get a Manifest with the folllowing conflict:
Export-Package: A;uses:="B,C"
Import-Package: B
Package A, B, C all reside in separate plugins, also named A, B, and C. At runtime, Eclipse does not load plugin C, and so I get a crash. Also, the Eclipse tooling appears to only look at Import-Package, because the tooling is also unaware of the dependency on C.
Should Import-Package always contain all of the packages in the uses statement? Is it an Eclipse bug, or (more likely) what am I doing wrong with bnd that's causing it to miss the dependency on C?
For your question:
Should Import-Package always contain all of the packages in the uses
statement? Is it an Eclipse bug, or (more likely) what am I doing
wrong with bnd that's causing it to miss the dependency on C?
The answer is: No.
With Importing you are declaring which packages your bundle needs, with exporting you declare which packages you give away to other bundles. The uses is a hint for the resolver that the Importing Bundle which needs package A will also need to import package B and C.
This makes it easier on the resolving mechanism to find the appropriate bundles. Especially since the bundle that exports A does also need to import B but not C.
Clarifying question:
It seems like Import-package ought to contain everything in uses, I'm
trying to understand a scenario where it wouldn't.
Bundle A is your bundle and exports package my.a.package
it uses package their.b.package from Bundle B and therefore Imports it.
This is the simple stuff here. Now since you export my.a.package bnd analyzes also Bundle B for you.
Since you aren't explicitly using any classes from Bundle C those aren't imported.
But since bnd analyzed Bundle B for you it knows that packages from Bundle C are used as transitive dependency in B.

Dependencies between plugins

I wrote an app which uses plugins, everything is ok, I made my plugins with the bundle template of Xcode.
Now, I need to write a plugin that depends on another plugin, let's say plugin A depends on plugin B.
I tried to link plugin A with plugin B by adding it to the project (link binary with libraries) but that does not work (tried with the full bundle and with the plugin object file inside the bundle).
The only way I found for the moment is to add source files of plugin B to the plugin A but it is bad because in the application, both plugin A and B contains same code (Class X is implemented in both Y and Z. One of the two will be used. Which one is undefined).
How can I implement that ? Thank you
Ok, I found a way to achieve that.
Just copy or reference the header of the classes I need and then use the -U linker flag (in the Other Linker Flags option) in the following form :
-Wl,-U -Wl,_OBJC_CLASS_$_NameOfTheClass
(Wl option is needed, see here why : http://www.cocoabuilder.com/archive/xcode/264371-ld-undefined-symbols-argument-is-ignored.html )
The -U flag for a class allows to compile without having the definition of the class.
With that, I can compile the plugin without duplicating the code of plugin on which I depend.

Maven dependency

Hi i have a quite simple question about maven dependency. I have 2 modules of one project. So first module is dependent on second. Second module has dependencies on some libs. Second module can be itself installed as standalone app. So when i build the project the first war will contain packaged second module as well as all libs that second module depends on.
I need that when i package first module the second module should be included without it's dependencies. How it is possible to manage?
Thx
I need that when i package first module the second module should be included without it's dependencies. How it is possible to manage?
Somehow, this is an hint that the dependencies of the 2nd module are provided when it gets packaged inside the war. IOW, declaring the dependencies of the 2nd module with a provided scope would do it, they wouldn't get pulled transitively.
Depending on how you create the standalone distribution of the 2nd module, you might need to combine dependencies scope with profiles, or not. Can't say since you didn't say anything about this :)
References
Dependency Scope