Reputation: 3
I have a Multi Project wich has the following structure:
Where "plugins" is just a directory.
Now I have a couple classes inside "globalOptions":
And one class inside "commandPlugin":
The "CommandPluginTest" class uses"OptionExtension" and "OptionHandlerExtension" from the other project:
import at.lyze.plugin.globalOptions.extensionpoint.OptionExtension;
import at.lyze.plugin.globalOptions.extensionpoint.OptionHandlerExtension;
List<OptionHandlerExtension> optionHandlers = wrapper.getPluginManager().getExtensions(OptionHandlerExtension.class);
for (OptionHandlerExtension optionHandler : optionHandlers) {
logger.warn(optionHandler.getOption(getClass(), "TestOption"));
}
My gradle build files look like:
"globalOptions":
dependencies {
compile project(':pluginApi')
}
"commandPlugin":
dependencies {
compile project(':plugins/globalOptions')
compile project(':pluginApi')
}
When trying to run the "jar" task on every project I get the following error:
Note: Extension found in at.lyze.plugin.globalOptions.GlobalOptions$TestExtension
:plugins/globalOptions:compileJava
:plugins/globalOptions:processResources UP-TO-DATE
:plugins/globalOptions:classes
:plugins/globalOptions:jar
Note: Extension found in at.lyze.plugin.commandPlugin.CommandPluginTest$BlarghExtension
C:\Users\wml\Desktop\LocalRepos\darkowlbot\plugins\commandPlugin\src\main\java\at\lyze\plugin\commandPlugin\Co mmandPluginTest.java:3: error: package at.lyze.plugin.globalOptions.extensionpoint does not exist
import at.lyze.plugin.globalOptions.extensionpoint.OptionExtension;
^
C:\Users\wml\Desktop\LocalRepos\darkowlbot\plugins\commandPlugin\src\main\java\at\lyze\plugin\commandPlugin\Co mmandPluginTest.java:4: error: package at.lyze.plugin.globalOptions.extensionpoint does not exist
import at.lyze.plugin.globalOptions.extensionpoint.OptionHandlerExtension;
^
C:\Users\wml\Desktop\LocalRepos\darkowlbot\plugins\commandPlugin\src\main\java\at\lyze\plugin\commandPlugin\Co mmandPluginTest.java:52: error: cannot find symbol
public static class BlarghExtension implements EventProcessorExtension, OptionExtension {
^
symbol: class OptionExtension
location: class CommandPluginTest
C:\Users\wml\Desktop\LocalRepos\darkowlbot\plugins\commandPlugin\src\main\java\at\lyze\plugin\commandPlugin\CommandPluginTest.java:76: error: cannot find symbol
public void initializeOptions(OptionHandlerExtension optionHandlerExtension) {
^
symbol: class OptionHandlerExtension
location: class CommandPluginExtensionClass
4 errors
:plugins/commandPlugin:compileJava FAILED
FAILURE: Build failed with an exception.
Have I done something wrong here or why does this fail? I can provide additional information if needed.
Running gradle 2.9
Edit:
Settings.gradle (Global project with every include)
rootProject.name = 'DarkOwlBot'
include 'pluginApi'
include 'core'
include 'plugins/globalOptions'
include 'plugins/commandPlugin'
include 'plugins/guiFeederService'
Upvotes: 0
Views: 286
Reputation: 23637
In addition to what @ReneGroeschke said, you should leave out the into ('classes')
line here. You're altering the structure of the produced artifact.
Upvotes: 0
Reputation: 28653
Most likely, gradle has problems with the '/' in project names. By default the project name is also used to create the jar for the project. This likely results in wrong file paths.
I think your best options to solve this are:
Change the include statements in your settings.gradle file to be
include ':plugins:globalOptions'
and reference globalOptions by
compile project(':plugins:globalOptions')
Change the include statement in your settings.gradle file to be
include ':globalOptions'
and configure the project directory explicit via project(':globalOptions').projectDir = file('plugins/globalOptions')
and reference it in your dependency block via compile project(':globalOptions')
Upvotes: 1