Can't add jars to my project
Answered
Hello,
I can't add external libraries to my specific project that I created using the plugin - they dont appear in the external libraries.
I created My ModuleBuilder - that only extends JavaModuleBuilder and I override the ModuleType.
I created also my ModuleType - that only has the name, icon and stuff.
But once I created the specific project through my plugin I can't add any jars + when I go into the Project Structure and go to Modules - I only have the name of the project and nothing more - in contrast to the regular Java Project.
This is the code of the Builder:
package Module;
import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
import com.intellij.ide.util.projectWizard.ModuleBuilderListener;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.roots.ModifiableRootModel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class AgentZeroModuleBuilder extends JavaModuleBuilder {
@Override
public ModuleType getModuleType() {
return AgentZeroModuleType.getInstance();
}
}
this is the code of the Type:
package Module;
import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.ModuleTypeManager;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import com.intellij.openapi.module.ModuleType;
import javax.swing.*;
/**
* @author Konstantin Bulenkov
*/
public class AgentZeroModuleType extends ModuleType<AgentZeroModuleBuilder> {
private static final String ID = "AGENTZERO_MODULE_TYPE";
public AgentZeroModuleType() {
super(ID);
}
public static AgentZeroModuleType getInstance() {
return (AgentZeroModuleType) ModuleTypeManager.getInstance().findByID(ID);
}
@NotNull
@Override
public AgentZeroModuleBuilder createModuleBuilder() {
return new AgentZeroModuleBuilder();
}
@NotNull
@Override
public String getName() {
return "Demo Module Type";
}
@NotNull
@Override
public String getDescription() {
return "Demo Module Type";
}
@Override
public Icon getNodeIcon(@Deprecated boolean b) {
return IconLoader.getIcon("/Icons/new-project.png");
}
}
and there's a problem in the project structure that says:
Library Plugin Jars is not used
but that doesnt happen if I create a regular java project without any java file that uses the jars.
Please sign in to leave a comment.
What is the purpose of AgentZeroModuleType? What is its registration in plugin.xml?
this is the registration:
See org.jetbrains.idea.devkit.module.PluginModuleBuilder#commitModule as sample for automatically creating run configuration
Can't find org.jetbrains.idea.devkit.module.PluginModuleBuilder on web, could you write the URL?
It is part of Devkit plugin part of IntelliJ Community sources.
Sorry for my stupidity but I don't understand what you're talking about..
I entered this URL https://github.com/JetBrains/intellij-community and wanted to search for the code you talked about.
I highly suggest to checkout IntelliJ Community Edition sources, otherwise you'll be unable to find sample code easily.
See its README.md for required steps, then you can just use "Goto Class"