which file should I run in Git Repositories? - eclipse

I'm using eclipse. I created a git repository and pulled some code from a url. I want to run that code but when I try to run, I get this error:
Select what to run:
Ant Build
Ant Build...
Is the code in git repository not executable?
How can I run this project? Any help is appreciated.

A git repo doesn't know about the nature of the text files it stores: it just make sure they are replicated exactly the same.
Once clone, you need to check haw the project work, independently of Git.
In this case, see "Eclipse: Running Ant buildfiles", or use the Ant view in Eclipse.
You can make one of the ant target run automatically too.
If this isn't an ant project, see:
"what is this ANT build?".
make sure your java project as a builder (if not, by default, Eclipse proposes ant), as in "Eclipse won't compile/run java file"

Related

How to check out multiple maven projects from remote git repository

after a couple of hours trying and reading a number of tutorials, I can't fix the following problem: I have a remote server running a git repository. From eclipse (neon.2 and egit) I pushed several maven projects, each with its own pom.xml to this repository. When a friend of mine, who wants to co-develop tries to setup his environment, also using Eclipse Neon.2 and egit, we are not able to reproduce the setup in the Package Explorer. We get all the sources but in one project. The original maven projects are all nested in this one project. This wrong setup results in a couple of problems when trying to compile or run the projects.
We used File-> Import-> Git-> Projects from Git-> Clone URI. In Source Git Repository we pointed the Repository path to /home/git/workspace.git. In the Branch Selection dialog we can then only see the master. In the following Local Destination dialog we checked the Clone submodules checkbox. We played around with the following options to run wizards which were all failing, so we ended up with this one project option in the bottom of the three options in the dialog.
What is not happening, is the import projects dialog as explained here https://wiki.eclipse.org/EGit/User_Guide/Remote#Import_Projects
(but this seems to be a former version, since the Clone submodules checkbox is missing in the dialog before on this web page)
Can anybody please tell us how to extract the maven projects as top elements in eclipse, linked to the existing git repository, such that we can work as a team?
Should you need any additional information, please let me know.
Thank you in advance.
I would advise you to always put all Eclipse configuration files to the repository when creating projects. What you should do is add all necessary maven integration related files to the repository (.project, .classpath, .settings/*m2e.core.prefs or better yet entire .settings). If you have done so, you are fine. If not, add them and pull changes on your colleague's machine.
On target machine remove the project from workspace, but do not delete contents. In Eclipse Git repositories view select your repository and expand to see Working tree. Right click it and select Import projects. This will trigger the flow you pointed our at Eclipse wiki. From there it should be straightforward - Eclipse will try to detect projects and will import them, so that they have Maven nature and are managed by EGit.
If you don't want to or cannot share maven configuration in the repository, have a look at this answer which tries to describe how to achieve that without Eclipse configuration files.

SVN Checkout of multi module maven project causing build issues

I am trying to learn how to setup multi-module maven project and share it with colleagues using SVN.
We work with eclipse IDE.
Here is how my project structure looks in SVN.
Each module has its own svn labels and tag trunk, branches, tags etc.
I check out all the modules individually by right clicking on them and choosing check out.
Finally I get the below in my eclipse project explorer:
Here is my pom for the parent project. and this throws errors when I do a mvn clean install
I want to understand how to checkout the projects/ modify my pom to get the build successful.
Thanks
You don't want to check out the root folders of your modules in SVN. All you want is the content of the trunk. So right click on the trunk folder and select Check out as.... Check it out as new projects and enable Maven on those project afterwards. Do this with each of your modules and you should be fine.
If you have Maven SVN connectors installed you have an option called Check out as Maven project. This is very comfortable as it does a few steps for you.

Eclipse Maven - Auto Increment pom version before committing to GitHub?

I am looking for a solution to this. Here is my setup:
Local Eclipse with all maven projects on. When i commit them to GitHub, my Jenkins server automatically builds the project. (For every push to github)
However, in my Maven repository on the Jenkins server, i want to be able to get each one (1.0.1 -> 1.0.2 etc.) is there any way i can do this? Ideally an eclipse plugin so that it changes the version before it gets to GitHub.
If i used the maven-version-plugin, it would not update on my local eclipse machine, therefore it would just use the same version each time.
Any Solutions?
I would suggest to use the maven-release-plugin which exactly does things like this. This comprises of two steps. First mvn release:prepare and second mvn release:perform.

How to automatically change Eclipse build path when I check out Git branches

I'm using Eclipse Helios and EGit 0.11.3.
I have a project where different branches use different versions of some of the libraries on my Java build path. For example, branch_old uses foo_lib_v1.0.jar while branch_new uses foo_lib_v2.0.jar.
If I'm working on branch_new and I need to checkout branch_old to test something, it's a bit of a hassle: I must manually reconfigure the build path in Eclipse before the project can build successfully.
Is there a way to store Eclipse's Java build path configuration for my project in git, so that when I check out a branch the build path is automatically modified? If not, is there another way to achieve the same result?
Thanks.
I see several choices here:
store project files (.classpath and .project) in Git as part of your branch. This way you would have to store all your dependencies in Git too, which is a hassle if you have a lot of them.
use Maven (m2eclipse plugin) and store project definition (pom.xml) file as part of your version control. Maven will greatly simplify your project dependency configuration
More information on m2eclipse plugin can be found at http://www.sonatype.com/books/m2eclipse-book/reference/
Should work: Put the .buildpath under version control. So its checkouted every time you switch the branches.
AFAIK Eclipse stores his build classpath in a file like .classpath(?) You can just add the file to git and have an own config for each branch.
Define several user libraries in your workspace, such as FooLib1, FooLib2, FooLib2. Then in the project's build path at a given branch reference the appropriate version of the library. Make sure you include project metadata files such as .classpath in your git repository and you should be set.

Why don't eclipse run configurations survive a merge?

I had some nice eclipse run configurations I had created while working on a branch in SVN. I then merged these changes back into the trunk, and now my eclipse run configurations are gone. Why? My eclipse configuration directory is totally separate from my svn directory.
Try saving your run configurations as "shared". They will be saved as .launch files that you could add to your SVN repository to make sure they don't get lost again.
Example here