Lets say I have n projects in eclipse and they are only conceptually connected.
How to add every one of these projects as a package in a new umbrella project?
In Eclipse you can hook projects together using the Project tab in your build path configuration dialog:
right-click on your higher-order project
select Build Path
select Configure Build Path...
select the Projects tab and add the other projects as references
You might also look into Maven as a build management system, which would allow you to create consumable libraries. Each of your projects would use Maven to generate a JAR artifact, and your umbrella project would use Maven to reference them as dependencies. I believe Ivy would also help you in this regard.
In order to logically combine the elements (in this case, projects) together, you can create a "Working Set" in Eclipse. There can be different type of working set.
Here are steps to create a Java working set (as the question is tagged as Java):
File - New - Others..
Select "Java Working Set" under Java.
Select the project you want to add into the working set and give a
Once the working set is created, you can use it at many place in eclipse. Personally I use them a lot in search to narrow the search results and on Package/Project Explorer to see only the projects I am interested in at the moment.
To emphasize that the Java working sets are just logical grouping of the projects, here are couple of examples.
Working sets "Batch Projects" and "Web Projects" based on type.
Working sets "SVN Projects" and "CVS Projects" based on the source repository.
Read more on the offical eclipse documentation.
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 ?
Wanted to get some oppinions here. I've asked a lot of friends for an answer on this and no-one havs ever gotten a good solution to it. I recently cloned a java project from gitlab and have no clue how to run it. I had to import it as a general project because its not an actual eclipse project. But then I have no clue how on earth it was uploaded in this file structure in the first place?
In case of very simple project, often you can right click on the source folder (could be more than one) and select "use as source", then you need to add all of the libraries by right cliking on them and using "add to build path".
If it is other kind of project like maven, gradle etc... they have own tasks to eclipse-ize the project, check documentation.
There is no single and straightforward way because there is nothing like one and only valid standard of project structure and/or dependency management.
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.
I'm moving over from eclipse to Intellij, and I hit a snag on setting up my project
I have 4 projects on github that, in eclipse, all live in one workspace. They are API, Server, Client, and Basic Plugin, and they each have a Maven pom.
What I want to do is set up Intellij's project structure similar to Eclipse's workspace, where all 4 of those projects are side by side in the explorer, but it's not letting me import more than one maven project as a module (I import the first fine, but the rest silently fail), and importing directly from github creates a whole new project for each repository, which is not ideal.
I tried to import a in my eclipse workspace, but it all broke (Object and Math were not found), and all the java environment setting were wrong.
Any ideas? I'm fairly new with Intellij and I really like it, but I don't want to switch over from eclipse if I can't get my workflow right.
First of all, Intellij IDEA uses different naming than Eclipse, you can learn the details here: http://www.jetbrains.com/idea/documentation/migration_faq.html. In short, Eclipse's Workspace is called Project in IDEA, and Eclipse's Project is Module in IDEA. In your case, you want to have multiple Maven-based modules in one Project. You can do it by creating a Project with one Module and then adding the rest of Modules (File->Add Module->Import Module from external model->Maven etc.).
As for the multiple Git repositories, you can configure that using this help page: http://www.jetbrains.com/idea/webhelp/git-branches-in-multirooted-projects.html
In your case, have a look at the 'Asynchronous branch control' section). It's really straightforward, I have just done it myself for the first time by following these instructions.
Good luck.
UPDATE: The above link now gives 404, so here are the most up-to-date ones that may be of help:
https://www.jetbrains.com/help/idea/2017.1/git-branches-in-multirooted-projects.html
https://www.jetbrains.com/help/idea/using-git-integration.html
IntelliJ opens one project at time, but this project can have multiple modules ( say, maven reactor ). So modules are kind of [related] workspace projects in eclipse. You also can open several independent projects in different windows.
In case you have working maven reactor build, you can just open topmost pom as project and everything will be set up. ( treat maven reactor as your workspace )
I have a eclipse workspace which constitutes of 15 different java projects . To configure the eclipse workspace , every time I need to add the java projects manually and add the dependency and refrences in the java build path.
Adding all the projects and resolving dependency every time becomes a manual and redundant task. I explored on the .classpath inside the every projects which stores the dependency and refrences information.
I would like to automate this redundant process.
Have any one tried doing that , any inputs will be helpful.
I don't need to add same project more than once , but often need to create a new eclipse workspace with new code changes and delivery (I can't take some of the changes in the current work space).In simple terms for e.g if some one need to create eclipse workspace again and again , or multiple people need to create the same workspace for their work . How can we reduce that manual effort?
I am still a little unsure about your motivations but I am going to assume that by new code changes and delivery you mean a different revision/branch of the same code base. For this purpose and for many other reasons, if you are not using source control like SVN or Git, look into it. These tools are priceless and also free.
Eclipse
I don't think this is technically part of your question but I wanted to add it for completeness. If you're implementing the techniques below, it is also handy to have a 'fully loaded eclipse'. I keep a 'fully loaded eclipse' on a network drive somewhere with some plugins pre-loaded so that new additions to the team don't have to download/install the plugins. It's not hard to do since eclipse doesn't need to be 'installed'. You can just copy the eclipse folder to where you want it and run it. Personally I like to include plugins for source control, code style, code coverage and metrics but you should include anything that you use consistently in your project.
The Workspace
To copy an existing workspace (not including any projects, I'll get to that later) all you have to do is copy the .metadata folder from an existing workspace folder to an empty folder that will be your new workspace folder. When you start up eclipse simply choose the new workspace folder and you will have all the same preferences as you had in the other workspace.
I have used this technique before so that when people join a project they can take a copy of a 'clean workspace' I keep on a network drive somewhere that helps them get up and running quickly. Preferably, this 'clean workspace' should not have any preferences that are only personal preferences like having the perspectives setup just the way you like it but should only have preferences like Ant global properties, compiler compliance level, pre-made commonly-used external tool and run configurations etc.
Projects
For the projects themselves, I would recommend checking them into source control including the eclipse .project and .classpath files. The SVN plugin (subclipse) makes it very easy to do this. Then when someone joins your project, all they have to do is check them out as projects in their new 'clean workspace' which is also very easy to do. Since the project you're checking-out already has the .project and .classpath files, all of the dependencies are already setup! Just make sure that all the jars and any other dependencies are checked-in with the projects.
Workspace Setup Procedure
Take a copy of the 'fully loaded eclipse'.
Take a copy of the 'clean workspace'.
Check out the projects into that workspace.
That's it! Your new recruit should be ready to go!
Multiple Code Branches
Now, if I was right to assume that by new code changes and delivery you mean a different branch of the same code base, creating a workspace for a different branch as easy as following the same steps but checking out the required revision or branch instead of the latest version from the trunk. If you don't quite understand what I mean by that, read up on source control.
Cudos
Good on you for taking the time to do this, I have been in projects where it can literally take a day to get setup...
Maybe little late, but stuck into the same problem and found a tool in eclipse marketplace that helps to manage setting up and launching eclipse all time for different branches, new developers or other reasons.
The tool is called yatta.
With this, one can create profiles which can be based on their current running eclipse with all the tools, plugins, workspace, CSM repos and what not.
This profiles can be exported to yatta profile hub which can be public or private and later shared with different developers and can be imported and launched.
You don't say whether you're using a build tool other than Eclipse, but if not you should.
Eclipse is able to parse Ant files to discover the source directories and libraries. And Maven and Gradle can both generate Eclipse project files for you to import.
As a longer-term benefit, using a build tool means that you can easily build and deploy your projects without any need for Eclipse. And it will be easier for new team members to work on the projects, as they won't need to figure out all the dependencies.
If you don't already have people with expertise, I would recommend Maven. It's easy to set up a basic Java build script, and its dependency management features are IMO better than the alternatives. It will, however, force you into its way of doing things, particularly wrt source tree layout.
You should really look into build tools like Maven, Ant, .... Those can generate needed classpath variables for you automatically and can do many more things as well
If you're checking out the projects from CVS / SVN in Eclipse, then it's possible to create a Team Project Set. This is essentially an XML file that will contain a list of projects and their source repository path
It can be exported via File | Export | Team | Team Project Set, and imported into another workspace via File | Import | Team | Team Project Set
There's more information on this feature at this link on Javalobby
Using vagrant it is quite easy to automate setting up an entire desktop development environment.
See the answer I provided to a similar question here, which has links to scripts that automate checking out maven projects, creating an eclipse workspace and importing the projects.