kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
173 stars 57 forks source link

Add classpath for Matisse #391

Open BirgerK opened 6 years ago

BirgerK commented 6 years ago

Hi there,

thanks for your work in this plugin! We're using it now every day currently in version 1.4.3. Some days ago we moved our project from Maven to Gradle.

Since that move we have a problem while using Matisse. We need some custom libraries in the Design Editor. Somehow the Maven-based project injected our custom libraries into the Matisse-classpath and it worked out of the box.

By moving to a Gradle-based project, Matisse is now missing the custom libraries. We found a workaround which is not really scalable: We start netbeans with the argument -cp:a "/path/to/customlibrary.jar". Of course that's not really pretty....

I found the issue #88, which had a similar problem with Matisse. Maybe the defined compile-dependencies must be added to the Netbeans- or Matisse-classpath or something...

Do you have an idea for this problem? Is there already an issue which points to this? (I didn't found one)

Thanks for your help! Regards from Hamburg Birger

kelemen commented 6 years ago

It was a long time ago since I used Matisse for anything but if I remember correctly, this is how it works (for):

In Tools/Palette/Swing AWT components:

BirgerK commented 6 years ago

Thanks for your response and the HowTo. I added the dependencies-project to every Swing-Palette (Swing Containers, Swin Controls, Beans, Borders,...), but it doesn't help. It still can't find the components.

Maybe it's in the same place like #88?

kelemen commented 6 years ago

88 is about internationalization support and it should still work. I have tried the Swing components and they work for me. It shouldn't matter where you add your component (I would add it to a new group), what matters is the class name. Check the class name in the .form file (you have to do this outside of NB, since NB will hide the .form file).

BirgerK commented 6 years ago

I checked the class names and they match. The exception shows exactly the name which was added to the palette. But the exception stays.

It worked as a maven project. As a maven project the dependent library was loaded from a nexus.

Now the project is a grade Multiproject, where the dependent library is included as a subproject. Maybe the plugin is not including subproject-classes for Matisse?

kelemen commented 6 years ago

You have to add the particular subproject containing the component needed (and select that component when adding it to the palette) and not to root project.

BirgerK commented 6 years ago

Hi again,

some more explanation: My project is a multi-gradle-project with this directory-structure:

/
|- build.gradle
|- child-project-A
             |- build.gradle
|- child-project-B
             |- build.gradle

child-project-B contains some custom Swing-components which shall be used in project child-project-A. There the content of child-project-A/build.gradle is:

dependencies {
   compile project (':child-project-B')
}

I added also the subproject child-project-B to the NetBeans-Swing-Palette. By doing this, it doesn't work! The Swing-forms are missing their Component-Classes

Now I tried child-project-A/build.gradle with this content:

dependencies {
   compile group: 'org.example', name: 'mighty-swing', version: '1.+'
}

So child-project-A does now use a prebuild artifact from child-project-A and not a subproject. this approach works! The NetBeans-Swing-Palette is configured like before: "I added also the subproject child-project-B to the NetBeans-Swing-Palette". The only thing I changed is the way how the child-project get included into the classpath.

Does this help?