Subclipse checking out as folder not Java project - eclipse

I'm trying to import a Java project from my teams subversion repository. So I go through the import GUI for subversion, select my repository and the project, then choose to check it out as a project into the workspace.
However, the project now appears in my workspace simply as a folder:
Trying to add a new class tells me "source folder is not a java project". Is there something I am missing? Thanks.

Check out as a project only does what you want if you have checked-in the Eclipse .project, .classpath files etc. In that scenario those files get checked out and configure the Eclipse project. Otherwise you are just getting an Eclipse "Simple Project" which does not have the Java tools configured.
I assume you do not have those Eclipse files in your repository, so you want to use the other option that lets you run the Eclipse Create Project wizard as part of the checkout. This lets you choose the project type and setup some of the configuration. You can skip most of the configuration since you can also do that after the checkout finishes if you prefer.
See: Subclipse Checkout Documentation

Related

Automatically generate .factorypath on project import when using Maven project in Eclipse IDE

The .factorypath file is a generated file, which eclipse requires for annotation-processing. The m2eclipse plugin does generate this file when using "Update Maven Project" (Alt+F5) and checking "Update project configuration from pom.xml".
However, I don't want to check this file into version control. But if not, and someone from the team does a fresh checkout, and imports the project in eclipse, the .factorypath does not get generated until the "Update Maven Project" is performed manually. I don't want this manual step when a project gets imported, this has to happen automatically. Is there an option, that a project has to be updated upon import?
Since this is an IDE related question, and you seem to be using Eclipse IDE:
Menu Window > Preferences > Maven > Automatically update Maven projects configuration .
This will make it for you on project import so you would not need that manual step anymore.
Assuming your real issue is
I don't want to check this file into version control.
Though you have not specified which version control you are using but if you are a GIT or SVN user, you need to add files/directories pattern in GIT ignore file or SVN ignore properties.
Read more on GIT Ignore or SVN Ignore.

FindBugs plugin does not work on projects imported from GitHub

I have always used FindBugs, and it is really useful in many cases. But I couldn't get to find why it does not work on projects imported from GitHub. Projects imported into Eclipse using Git as the source does not have an option to run FindBugs.
Does anyone know why, and a solution to this? I do love to use git extensions on Eclipse, as well as FindBugs.
Is the project that you imported from Git recognised as a Java project (i.e. it has a J under the project folder icon)? If not then FindBugs won't be enabled for the project. If that's the case the remote repository almost certainly hasn't added the .project and .classpath files which are what Eclipse uses to determine if it's a Java project or not.
You should be able to convert it to a Java project by right-clicking and doing 'Configure -> Convert to Java Project'. If that doesn't work, delete the project (but without deleting the files) and then create a File -> New Java project in the same location.

How to use SVN to build a library

I am trying to follow a tutorial, and I am told to:
1- Get the source code for the Java EMV Reader library from http://code.google.com/p/javaemvreader/ and build it.
2- Drop the resulting jar file in lib/.
3- Import the project in Eclipse and build it.
I right click the java files, and choose run as but don't get an option to run as Java Application. I also can not export the files as a JAR file. I have enclosed an image of what I have
After the first comment, I right clicked on my project, and under Maven, chose the option "configure as Maven" project. ( Thank you so much; this must be one of the fastest resolutions in the world )And I can now run the project. I get the window in my pic2, which I have attached. I don't however know what step 2 of the above instructions means. I don't see a lib/ folder. And the project he is refering to in step 3 is on git. Any ideas on what he means? ![pic2]!1
Eclipse projects have a "type" and that controls what tools are available. You probably created a "Basic Project" which means there are no compilers or other Java tools associated with it. You would want to create a Java Project in Eclipse.
That project does not seem to have Eclipse .project and .classpath files checked into the repository. It does look to be a Maven project however. So you would either want the m2eclipse plugins installed, and check this out as a Maven project, which would handle configuring everything else, or you want to use the Checkout As ... option and use the wizard to create a new Java project to checkout.
These are more Eclipse IDE questions than SVN or Subclipse questions.

Can't run project in Eclipse imported from Git

I have a project in my Eclipse workspace from Github (via File -> Import -> Projects from GIT).
However, I am unable to run the example because the only option I have under "Run As" is "Run Configurations."
After going to "Run Configurations" I click "browse" and the project that I imported from GIT isn't there.
Any ideas?
The question is already answered in the comments but I am providing this answer to possibly clear up some misunderstandings.
In order to recognize a folder as a (Java) project, Eclipse needs to read (or create) a few files for each project, like .project and .classpath. If you do not have them in your project, or do no create them during the import, then Eclipse just imports it as a resource, or a dumb folder.
If your project is tracked by git and is also a maven project, you can clone it locally with Git (command line or GUI tool) and then "Import as existing Maven project" in Eclipse. This will use your pom.xml to create the two files mentioned above and your project will be buildable.
Alternatively, if you have already imported it as you described in your question, you can right click on your project on Package Explorer and choose Configure-->Convert to Maven Project. This will create the .project and allow you to build the project using Maven (right click->Run as..-> Maven build) and Eclipse's incremental builder (where necessary). If your maven project builds an executable, the option to execute it will also be available in the Run as.. menu.
If you have a more complex maven project (like an aggregate pom), and want a Run Configuration that runs a specific program, you will have to write it yourself by opening the Run Configurations window and explicitly referencing the java class.
Don't import the project using git clone. Download it as zip file and extract it. Add it using Project>import> General> Projects from folder and Archive.
Provide path of extracted folder into import source and finish and go to eclipse and clean and build safely run and right click on project and run it.
It should work

Unable to launch java application in eclipse after mercurial clone

I guess this is a Eclipse question.
I have a mercurial repository with a source folder (src/main/java/) and some source code. The repository also contains a build.xml. After cloning the project into Eclipse using the Mercurial plugin I'm unable to configure a launch configuration for my project. Eclipse is unable to identify the newly cloned project as a project when setting up the launch configuration. What am I missing?
TIA
What kind of launch configuration are you using?
an External Tools Configuration (in which case you defnie and Ant Build with a direct link to your build.xml)
or a "Run Configuration", meaning your repository must include a .eclipse and a .classpath for eclipse to list your project as one being able to Run.
As discussed before in Which eclipse files belong under Version Control, those two files can be versioned, provided they only use relative path.
Do you have a .project file?
If you do, you should be able to use File->Import->General->Existing Projects into Workspace.
If you don't, try File->New->Project and there are various different options to create a project from existing source.