I am developing a plugin for IntelliJ as part of a larger research team. The logic for the plugin was developed and tested as a Java project in IntelliJ IDEA. Now the time has come to develop the front end, and the module is not configured as a plugin. How should I go about converting the Java project to a plugin project?
It is not reasonable to start the project over as a plugin project, because it has complex dependencies on several other modules.
This is a similar question to how to import existing plugins, but is different because the code is not a plugin yet.
These are the steps I have followed so far:
Create a new action class (that extends AnAction) to be the main class for the plugin.
Create a run configuration for the plugin. I get this error: Run Configuration Error: No plugin module specified for configuration
Follow the instructions given by OpherV in the question I linked to above to change type="JAVA_MODULE" to type="PLUGIN_MODULE" in the .iml file.
The third step did not resolve the "Run Configuration Error: No plugin module specified for configuration issue." What additional steps are needed?
I am using IntelliJIDEA (Community Edition) 14.1.4 Build #IC-141.1532 on OSX 10.11.1.
I was able to successfully convert the project into a plugin by following these additional steps:
Create a META-INF directory in the root of the project. Inside of this directory create the plugin.xml file. In plugin.xml, register your action. See the IntelliJ code samples for examples of what this file should look like.
Right-click on your project root in the project view (Cmd-1 if it’s not open already) and choose “Open Module Settings” (Cmd-down). This will open Project Structure > Modules > Dependencies.
5.1. Alternately, you can get here by opening the Project Structure with Cmd-; and then choosing Modules and picking your project from the list and going to the Dependencies tab.
Make sure the module SDK is the IntelliJ Community Edition instead of the normal Java 1.8 (or whichever version you have). (I noticed that this changed a line in the .iml file, but you should change the SDK here so you can create it as described here.)
At the bottom of the dependencies window, there is a plus. Click it, and follow the instructions given by samkass in the answer to this question, which I will reiterate here with more context-specificity for ease of following them:
7.1. Once you have clicked on the plus button, select “Jars or directories…”
7.2. Navigate to the META-INF folder, select it, and click OK
7.3. In the dialog that comes up, select “classes” and NOT “jar directory”
7.4. Make sure you’re using that Module in your run target
Once I followed all of these steps, the "Run Configuration Error: No plugin module specified for configuration issue" went away and the Run Configuration I had created worked. I ran it and my action was available in the Refactoring menu as I had registered it in plugin.xml.
Related
The scope of this question applies after you have created an RCP app in eclipse following Vogella's tutorial linked below. This assumes your feature, product, and father project are created. In this state the feature is delegated the task of building, therefore all dependencies need to be resolved in the feature build.properties file.
This question addresses when the missing dependency needs to be installed, i.e. is downloaded manually because the missing dependency is not on the class path. The class path determines what plugins are available in the feature/included-plugins tab. The plugins listed in the feature/included tab can be added as plugins for dependencies to your plugin. This list gets appended to your feature.xml file which gets linked to your build.properties file! See Solution below.
Eclipse nomenclature interchanges the ideas of plugins=dependencies and treats them the same. We know this by the names of the tabs.
The intent of this question is aimed at using existing Eclipse capability to develop an RCP application that uses objects from a third party plugin to create a custom workflow.
This error is thrown because my RCP app third party plugin requires this dependency which was not included in Eclipse ICE nor the plugin itself.
The first thing I tried was to install the plugin directly from the Eclipse Marketplace.
The string org.apache.commons.beanutils returned nothing so I went to apache and downloaded the plugin manually.
I then researched how to install a plugin in Eclipse manually.
I've learned not to simply drop the plugin into the Eclipse/dropins folder, which does nothing.
I've learned that this advice is lacking probably due to age of post.
I've learned when Maven is configured correctly, all the dependencies can automatically be resolved.
https://www.eclipse.org/forums/index.php/t/813199/
This says plugin dependencies are resolved by looking at four files.
"The plug-in definition, the product file, the run configurations and the target definition."
The plug-in definition I'm not sure what that is other than the plugin.xml file. The product file has been configured to launch the third party plugin. I've learned the run-configuration has a list of plugins and the third party plugin is not listed there.
I've learned that the target definition should be created in the parent project of your product project.
Create a target definition by highlighting your father project->Right click-> new-> Other-> Target Definition. During creation select "Use workspace configuration." The path to your downloaded plugin was added to this Location.
After the Target is created, Navigate to the content tab and select Manage Using: Features
This reduces the number of possible dependencies to only the ones needed to run.
You should now see the dependency checked in the list.
Creating the target resolved the other twenty or so dependency errors but the one under the title still throws an error.
I've learned that the product file is the file that calls the third party plugin in runtime.
The RCP app launches, but I cannot import the third party plugin in the bound classes created using this tutorial, to be used to obtain objects programmatically.
http://www.vogella.com/tutorials/EclipseRCP/article.html
I have a shell of a program running and just need to implement the classes for each window with the objects I can get from a third party plugin import.
Thanks,
(Solution)
Thanks Brian for resetting my thinking which led me to learn about Eclipse a little more to figure this out.
The main problem is an external .jar is identified as the missing Import-Package. Mine was org.apache.commons.beanutils. You must go to the parent website and download the library. In this case apache's website. There is probably a better way to do this by repo. I'm hoping I can export the product with all the required dependencies :p
I may be able to skip a step or two here, but these were my working steps.
Get .jar into Eclipse parent project. Right click the parent and select New->Folder->Name it Lib->Finish. Right click Lib->Import->File System->Navigate to .jar. Highlight the included .jars->Right Click->Build Path->Add to the Build Path.
Add the missing .jar to your Ant class path. Ant is used to build PDE apps using OSGi. See the Eclipse Help for an explanation. This will allow your missing jar to become visable in the feature project included-plugins tab.
Window->Preferences->Ant->Runtime->ClassPath Tab->Add jar->Navigate to missing jar
Create a target definition as described above in your parent project and add your missing .jar to the target and set your target active.
If target exists, In Locations widget window->Click Add->Directory->Navigate to missing .jar.->Next-> Verify plugins are recognized in window->Finish. Click Set as Target Platform in upper right corner.
Open feature.xml in your feature child project. ->Click Add->Navigate to your added plugin->Click Ok
Save All - Launch product
Now onto the next dependency!
Sounds like you're confusing an Eclipse plugin with a jar dependency for your project. it sounds like your project needs a jar (the beanutils jar from Apache) . Depending on if your project uses Maven or ant (or something else) the way to add it to your project varies. Try googling something like "adding a jar in eclipse for a X build" where X is the tool used for your build (ant, maven, etc). No matter what you use, the end goal will be for that jar to show up the java Build path->Libraries for your project in Eclipse.
it seems to me that u need a better understanding of how dependencies are managed in OSGI/eclipse, therefore i concur with BrianPipa.
beware: that subject is quite large and not easy to understand and is way too large to be explained here. but be not afraid, google is ur friend:
a few pointers on research topics:
the relation ship of bundle/plugin and jars
how is code contained in a plugin exported (aka make visible) to other plugins so they can use it AND what needs to be done so that the using plugin (ie. declare that usage-dependency)?
how are feature related to plugins?
how are products related to plugins and features?
what is a target platform ?
and how do i define it and what does it need to include ?
how do i set it ?
I am trying to add a project in my Eclipse that is forked from the Github. It is a starter code and this is the first time Iam working with Git. I am under the impression that the Git code will come into my Eclipse environment under some Folder structure. But I am not able to map the source code into my Local. Steps I have followed are the following :-
* Created repository in Github.
* Forked the project.
* Setup username and user email from Git Shell application.
* Cloned the repository in my Git Desktop application.
* Using Team Command in Eclipse I tried adding project Share project, but the forked project that I want to be present there is not displaying.
Pardon my inability to identify certain obvious infos. let me know if any info is missing and ill append the info here.
Along with that here is the image of the package explorer.
As you can see the newsindexer-1 is the project that I have downloaded from Github. But I was under the impression that when I run configuration the Runner.java or Tester.java I would be able to pass some arguments. But I cant. Plus when I go to properties I don't see
any option of giving the Java Class Path et cetera.
Follow following steps to add java facet to your project
In the Project Explorer, right-click the project (newsindexer-1) and then select Properties, or right click on project and check Configure options
Select the Project Facets page in the in the Properties window. This page lists the facets in the project and their versions. Check on java facet there
Click on apply. see if J appears in your Project listing. (Like you have on you NewsIndexer project)
I have downloaded a 3rd party project, which consists of multiple files, including Java ones.
General structure is as follows:
<topfolder>
pom.xml
<subfolder1>
pom.xml
src
main
java
<normalclasspath>
resources
site
apt
index.apt
test
java
<normalclasspath>
Eclipse imports this project normally, but is unable to index its Java content. For example, I can't browse from a variable to its definition, and so on.
Also I can't set my own Build Path since it says No action available.
Of course, I can refactor folder structure myself to suite eclipse needs, but are there any automation means for this?
UPDATE
Yes, this is a Maven project and Eclipse already knows that it has Maven nature. The only option now is to disable it
But this is not a question. The question is how to add JAVA NATURE, so that Eclipse knows consistence of classpath and be able to navigate to class definitions and so on.
UPDATE 2
#75inchpianist's answer about facets helped partially. It was not available to select Java facet immediately, but required turning on facets at all first. Then Java facet was already there.
Now I see, that Eclipse interprets Java, but Maven interpretation is not full. Namely, no Maven dependencies interpreted (no Maven Dependencies node in Package Explorer).
The attempt to add it fails:
Right click on the project and select "Properties"
Within "Project Facets" make sure that Java is selected!
As this is a maven project (because of the pom.xml) you need to install a maven plugin for eclipse.
Next you have to right click on the project and choose "Configure->Convert to Maven Project".
Now you should have your normal java structure.
Assuming that Eclipse recognizes the project as Java project yu can do the following:
If you don't want to install a maven plugin into Eclipse you can make Eclipse recognize the source correctly by adding every src/main/java folder as Source-Folder to your Build-Path.
This is better than modifying the folder structure as you can update the sources without problem later.
Add following to your .project file and refresh the project.
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
I have two eclipse project. The second one depends on the first one. When I try to rename a java class of the first project (using the rename function on the java file on the project explorer) it correctly do the refactor of that project but it doesn't changes anything on the project that depends on it.
Is there a way in eclipse to tell the renaming function to act even on the projects that are linked to the refactored one? Thanks for help.
My Eclipse version is Juno.
Update:
Forgot to mention that the projects are linked to an SVN repository. Maybe it could be relevant.
Update 2:
I add more details after mliebelt request of clarification.
My Eclipse version is Juno, Eclipse Java EE IDE for Web Developers, build id: 20120614-1722.
I've installed some plugins: subclipse, JRebel, m2e, Eclipse Web Tool Platform.
The second project is linked to the first one as a project dependency in eclipse. I have added the first project in the project tab of Java Build Path. Everything seems to work fine, even the renaming function.
Then, I tried to put the two project in two different SVN repositories. I created two repositories on the SVN server and I installed on my machine the client tortoiseSVN and the eclipse plugin subclipse. Since I didn't succeeded in importing the projects on the server directly from eclipse, I copied the projects' folders in a different location and I removed the projects from eclipse. I used tortoiseSVN to import the projects, each one on a repository with the same name of the project, and than I imported the project back to eclipse. To do that I used the eclipse "import existent project into workspace" function with the "copy project into workspace" option selected. Everything seems to work but not the renaming function.
It does work (for me), so here is what I have done to reproduce the behavior. I hope that this helps to find the error.
Create two projects, and make the second dependent on the first.
Create some source code, so that you can refactor it. Ensure that a class in Test2 is dependent on a class in Test.
Select from the context menu of the method you want to rename. Enter there a new name for the method, only then is the Preview option available. Ensure that Update references is checked.
Press the button Preview to see which classes will be changed by the refactoring.
As you can see, it works for me. Please check what is different in your context:
Define dependency different
Use different refactoring (which possibly contains a bug)
... ?
I then added the two projects to a (local) repository (I use the plugin Subversive, it that matters), and have retried the refactoring, and it works the same way. What is that "it does not work if the projects are in SVN"? The projects have to be in Eclipse, refactoring cannot be done on the Subversion repository directly.
I have made another attempt to reproduce the error, but could not. Here is what has worked for me (no screenshots included):
Installed Java EE from Eclipse (version Indigo)
Installed Subclipse 1.8 from the Eclipse Marketplace.
Defined the 2 projects as before.
Added the projects to the different Subversion repositories by using Team > Share Project...> SVN > select the repository location > Finish
I have then deleted the 2 projects, and instantiated them inside the workspace by doing the following steps:
Go to the SVN Repository Exploring perspective.
Open in the view SVN Repositories your repository locations, and select for each project from the menu Checkout....
The projects will be reinstantiated insided the workspace, and the dependency between the 2 is not lost.
After that, I am able to rename a method as I have shown above.
The problem in my workflow, described in Update2, was that, when I imported back the projects to eclipse, I used "import existent project into workspace" function.
I had to use SVN Checkout Projects from SVN instead, choosing the repositories I previously created.
It's been tedious. This is the API I am trying to use. Its resources were set up in a pom.xml which I built using Maven. On built up, it gave me the project socrata-publisher that has
src/main/java the source folder with packages com.socrata.api com.socrata.data, com.socrata.util where each contains only .java
files
JRE System Library and Maven Dependency hierarchies where each contains a number of jar files
Problem is com.socrata.api and the 2 other contains classes which I want to deploy in a project outside socrata-publisher. I tried using import com.socrata.api but it didn't work. Moreover, since its a Java project and not android it doesn't have the is Library option in preferences which could rather give me the solution. Both socrata-publisher and tutorial (where i want to use the resources and which is the android application) lie in the same directory eclipseApps in My Documents.
Here's a little visual queue. Help will be greatly appreciated.
You will need to first of all get the output of the socrata project and all its dependencies.
In command line, going to the project folder of the socrata project, where the pom.xml file is, run MVN INSTALL. You shall see a jar file called socrata-api.jar in $HOME/.m2/repository. If you are using windows and installed MAVEN by default, $HOME should be your user profile folder. Once you see the jar file, add it to your tutorial build path.
I think what you actually want to do is just set up the "socrata-publisher" as a project dependency for your "tutorial" project. That will allow you to reference the built Socrata libraries from the code in your project.
Right click on the project and select "Properties". From within that dialog select "Java Build Path" on the left, then the "Projects" section, and click the "Add" button to add the "socrata-publisher" project.
I think that'll work better than creating a separate jar file that you then include, and then you can also keep the socrata-publisher code up to date using Git.