mercurial child projects not showing up as java projects after cloning the parent - mercurial-subrepos

I have a mercurial project as shown below:
Parent : Project 1 which is a folder with java files etc.
Project 2, Project 3 and Project 4 are child projects meaning they reside under the Project 1 folder again with their own java files and other associated files.
When I clone the parent project(Project 1) into eclipse, I do see the child projects as a part of my check out. However, when I make any changes to the java files in the child projects, they dont seem to behave like a normal java file. Rather no errors shown in eclipse and they dont seem to build automatically.
I want to know if this behaviour is normal or my only option is to clone the individual child projects to see them as java projects. Meaning clone Project 2, then Project 3 and so on.
Any help is appreciated.
Thanks.

Related

Organizing non-Maven source code in Eclipse projects

I am working with some sample source code that comes with a book that I recently purchased. This sample source code does not use Maven. When I imported the sample source code into Eclipse, it created a zillion new projects, cluttering my Project Explorer. I want to organize all the source code from the book under one Master project, whose name is derived from the book. After playing around quite a bit, I came up with a working solution that is reproduced below:
Created a Maven project, choosing the book title as the Artifact Id
{thereby organizing all the child projects under the book title}
In the Maven project, created multiple directories from Eclipse,
one for each chapter of the book (New --> New Folder --> Folder name) {this ensures that Eclipse has visibility to the directories}
Closed Eclipse
Copied the source code, chapter by chapter, to each of the directories created under the Maven project
Relaunched Eclipse
Sequentially imported the projects from each directory created under the Maven project directory in Step #2 (Import --> General --> Projects from Folder or Archive)
Although I have been able to realize my goal, I am uncomfortable with the fact that I am creating the Maven project solely for the purpose of organizing multiple non-Maven projects under one parent project. I am not making any use of neat Maven features like dependency management.
Q) What is the best way to organize multiple non-Maven projects under one parent project in Eclipse?
First of all, if these projects are all test projects unrelated to other projects, you can just create a new Workspace in Eclipse.
If this is not what you want, you can define Working Sets that organise projects.
It is usually not necessary to put projects into subfolders to organise them.

intellij Import eclipse

I just recently start to try to move to intellij. After trying it several time i have decided to make the big move. I have downloaded an evaluation of ultimate.
hence i have decided to import my project from eclipse. However i am having some difficulties.
1- When I import a project as a module (inside a a project in Intellij) for which i clearly specify where i would like the project to be imported (i.e. "Keep project and module files in") (i.e. in a folder of the original name inside the current intellij encompassing project folder)
>>>Intellij do not import the files but references the eclipse project from whithin a new folder that it create. I do not want to mix my source. I want to duplicate the source and have it in intellij. But intellij, is actually pointing to my eclipse project.
This is an issue for me. Is there a way to avoid that ?
The question how does the import actualy behave. Does it duplicate the all files and create a new dir with all the duplicate files and the conig, or does it simply create a new dir, with conf files that point to the old dir.
What should i do, if i want to go from a project A in clipse to a project A' in Intellij with A' as a clone of A where both are fully independent project ?
Can any one help or assist on this. Many thanks.
Import will not duplicate any files, it will create IntelliJ metadata (.idea, *.iml, *.ipr) files inside your project, so you can work on the same codebase with both IDE simultaneously. Also, you can establish a two-way sync, with Eclipse project configuration changes synced to IntelliJ module and vice versa.
Unless you want to create an independent copy of your original project(as you mentioned in the question), then just copy the contents into a new directory and import the cloned code into IntelliJ. The changes you make in one project will not be reflected in another project.
If you are using git, then you can simply clone the existing git repository.
$ git clone my-eclipse-project my-idea-project

Eclipse m2e multi-module project checkout and convert to maven

I have recently had need to checkout an apache project to do some fact-finding/debugging (specifically maven-surefire-plugin, see this question). This, like most other apache projects, is a maven multi-module project. So, in eclipse, I open up the SVN Repositories browswer, add a new repository, find the project and right-click->Checkout.... In the wizard, I click Checkout as a project in the workspace and type in the name of the project.
I have the project, now I need to let eclipse know its a maven project, so right-click->Configure->Convert to Maven Project. Now the parent project is a maven project. I can right-click->Run As->Maven Build and it works. But, all the modules are just folders. Eclipse doesn't know anything about where the source code is or even if it has any. In a single module project it would have set the source folder, build folder and other configuration automatically. Further more, if you are creating a multi-module project from scratch, you start by creating the parent project, then, when you add modules to it, they each show up as individual projects in eclipse with the physical directory living under the parent project folder as needed by the default maven build process.
So now, knowing how its done when creating new projects I can File->New->Project..., choose General->Project, give the project a name (I match it to the module name), uncheck Use default location and set Location: to the path on to the module inside of the parent project folder. After clicking Finish, and repeating the process for each other module I have something that looks similar to what I would expect. I now need to convert every individual module to a maven module in the same fashion as the parent project. Great, they are all maven projects, right?
So then I open them up, and the source folder is not set.
Argh... Then I go to each project, twist it open, and on the src folder I right-click->Build Path->Use as Source Folder. Lather, rinse, repeat... Once done on all the projects, it really looks and feels like I started this project from scratch. Things function.
My question is, is it really this hard? Am I missing a shortcut? Wouldn't it make sense if Configure->Convert to Maven Project on the parent pom realized it was a multi-module project and did all the work for me? This is a very painful process for apache projects as they all seem to have many, many, modules... Anyone know of a better process?
You could try to pull all the code down outside of Eclipse, import the parent project as an existing Maven project (right-click -> Import... -> Existing Maven Projects), and see if it all comes in the way you expect. Then right-click -> Team -> Share Project... on the parent project.

eclipse + svn: how to manage whole workspace with svn

I have a workspace with several projects that are build using maven.
I know that i can add each project separate to the svn, but how can i add my super-pom?
My super-pom is in the workspace directory and therefore not visible.
Can i configure eclipse to add the whole workspace directory to my svn?
Best regards
This is not exactly what you asked for, but I have used following pattern with svn-eclipse-maven combo quite successfully.
/pom.xml
- contains only referenced projects
/parent/pom.xml
- contains dependencies common to all projects, <dependencyManagement>, properties..
- the stuff you would normally put in root pom
/procject(X|Y|Z|...)/pom.xml
- normal project pom.xml:s
This way you only need to commit /pom.xml outside eclipse when you add or remove a project (witch is relatively rare). With this configuration parent and project:s are visible in eclipse and only root/reactor pom is not visible in eclipse.

Eclipse + Subversion (subclipse) + Maven (m2eclipse) multi-module project

I have some related legacy projects that are a mess and I would like to mavenize them as a multi-module project shared on subversion (first multi-module project, we've always had them separate). There are a few key parts 1) webservice, 2) various swing clients, 3) model (w/ persistence from hibernate), 4) core JSE tasks.
I've been messing around for a few days trying to correctly set it up using Eclipse (Helios), Maven (2.2.1), m2eclipse (0.10.0) and Subversion (1.6) for our team. I keep stumping myself or having random errors that force me to backtrack. I'm hoping someone can help me out with some best practices.
Here are some of the questions:
m2eclipse requires a "flat" eclipse project structure. Does that mean I should create a subversion repository for each module? If I do one repository and try to check in from the parent project I'm having a difficult time setting the svn:ignore property on the nested project target (and other) directories.
If I do a module per repository, I seem to be able to check them in ok. The question then is what is the best way to check out via subclipse? Is there a best order? Parent or child project(s) first? Do I need to checkout the parent project and modify the checkout path of the children project to be nested in the file directory that will allow me to then "clean install" from the parent project?
Or, should I abandon subclipse and m2eclipse and checkout and run my maven goals from the command line.
Or, should I just be using the SCM integration with Maven. Or, maybe just not even try to get a multi-module project setup.
What do others do? Does anyone have some documentation (I missed) or some links (Google didn't recommend)?
Thanks in advance for your feedback.
m2eclipse requires a "flat" eclipse project structure.
Hmm, m2eclipse supports nested projects AFAIK (or at least importing a nested project structure). I don't use Eclipse wizards to create my projects though so maybe I'm not aware of something.
Does that mean I should create a subversion repository for each module?
No, no, absolutely not and I wouldn't do that (this will be hard to maintain). However, depending on your projects release cycles, you might have to think about the layout of your repository (single vs multiple trunk/tags/branches), especially if you plan to use the maven release plugin. If some pieces have independent release cycles, then I'd go for several trunk/tags/branches. If you always release them all together (as a single product), then a single trunk/tags/branches should do it. I wrote several answers on the topic that may be of interest:
Migrating to maven from an unusual svn directory structure?
Maven parent pom vs modules pom
How to handle maven versions in a multi module project?
If I do one repository and try to check in from the parent project I'm having a difficult time setting the svn:ignore property on the nested project target (and other) directories.
What is the particular problem?
If I do a module per repository, I seem to be able to check them in ok. The question then is what is the best way to check out via subclipse? Is there a best order? Parent or child project(s) first? Do I need to checkout the parent project and modify the checkout path of the children project to be nested in the file directory that will allow me to then "clean install" from the parent project?
Whatever choice you'll make (multiple repositories or not, multiple trunk/tags/branches or not), it should be possible to checkout the whole project structure in one time (using svn:externals if required). At least, you should try to make it possible (and it is, see the links posted above).
But I repeat, I do not recommend using multiple repositories (unless you want independent revision numbers) and nothing forces you to do that.
Or, should I abandon subclipse and m2eclipse and checkout and run my maven goals from the command line.
I use Eclipse, m2eclipse, subclipse successfully, all well integrated (at least for the build and "check in" part). But I do the initial import and the initial checkout on the command line and then imported
Or, should I just being using the SCM integration with Maven.
I don't use it, I don't have the need for it.
Or, maybe just not even try to get a multi-module project setup.
There is no reason to forbid the use of a multi-modules project setup, multi-modules builds are one of the key part of Maven.
What do others do? Does anyone have some documentation (I missed) or some links (Google didn't recommend)?
Have a look at the links I posted :)
It is a bit tricky at first. The way I've typically seen it setup is like so:
In subversion:
- Parent Project
-- Module A
--- pom.xml (module A)
-- Module B
--- pom.xml (module B)
-- Module c
--- pom.xml (module C)
-- pom.xml (parent project)
Some things to note (you already know):
You have to have the child projects
listed as modules in your parent
project
You have to list the parent project
in your child pom's (as the parent
group, artifact, version)
When you check out the project from
svn, you need to do 'check out as
maven project' instead of the
standard 'check out' (this one can be
a gotcha)
I hope this helps.