jUnit tests won't recognize source files in cloned Netbeans project - netbeans

I have a project with jUnit tests that I created on a school computer with Netbeans 7.3. The
unit tests run great there. I have it committed to a github repository. At home I have Netbeans 7.4. I used Team->Git->Clone to clone the project down to my home computer. The project was created just fine, but all of my unit tests are flagged as "Duplicate Class."
If it works on one computer but not another, how do I trouble-shoot this?
I used Netbeans to initialize the Git Repository. Committed and pushed all my code to git hub. The GitHub repository has a copy of the nbproject folder. Both the school and home computer have junit4 installed. What am I missing?
The repo is here for anyone that wants to look: https://github.com/mmeier/Java113.git
UPDATE
Unit tests run just fine on the home computer. However the IDE is still displaying errors. Clearly a configuration issue, but I'm not sure where to look.

Not sure what was causing the problem but here's how I finally resolved it.
Uninstall/Reinstall NetBeans
Create new basic Java Application (create new project wizard)
Add new jUnit test for existing class.
When prompted, select to install jUnit 4
Clone project from GitHub as described in question.
Delete temp project created in step 2.
Feels like I'm doing a work-around. But for some reason cloning the project and then installing jUnit 4 didn't appear to work.

Related

what is the right way of importing a maven project in Eclipse and run it as a Java project?

I don't understand exactly what is the way of working with maven projects in Eclipse.
The problems I have are often with projects I download from github. If I set the project myself it usually work, so I think I'm doing something different from the majority of people.
I'll try to detail a specific case:
I clone a repo, let's say: https://github.com/spring-guides/tut-spring-boot-oauth2
In Eclipse I import "existing maven project"
The project has a "Maven nature" as indicated by M on the folder icon
I try to run java class with main from Eclipse. First strange thins is that the "Run As" menu doesn't have "Run as a Java application"
I have to configure the configuration manually. Now it runs, but strange things happens, like I can't edit the file as the "content assist" throw errors instead of giving the normal assists.
I notice that the project has no "source folder". So my first instinct is to add a Java nature or select src as source folder
So I add Java nature to the project. This is a disaster. It can compile anymore as it can find packages. All classes have errors. I try to play around setting source folders on /src or /src/main/java. Sometimes I fix the errors but I can't run (and now I have run as Java application) but when I run it can't load the class
So in the end, I'm a bit confused and I don't know if I explained clearly what I'm doing.
I think I would like to know in a simple way how people are doing it, rather than trying to correct my steps as I'm probably creating a mess myself.
Any help or suggestion welcome.
I'm using the last version of eclipse. I don't know which other tool's versions are relevant.
P.S. I also refresh,restart,clean rebuild the project often after touching things...but it doesn't get better
Maven is a build (management) tool. Simply spoken, its task is to create a JAR that can be used as a dependency/library by other projects or when running java -jar ....
Running a project's code isn't part of it (apart from unit and integration tests code and by using non-default plugins for special situations). Running code is part of Eclipse (or any other IDE) with its Run Configurations.

Clone and Build Pentaho Kettle

Sorry for basic question, but I have been trying for a while and cannot get anywhere with this.
Any one have experience clone the Pentaho-kettle project and import it into eclipse?
I follow the instruction from https://github.com/pentaho/pentaho-kettle.
I did the following
cd pentaho-kettle
ant clean-all resolve create-dot-classpath
Then I go into eclipse and Import Existing Project into workspace. Note that I am importing from the root folder. Should I include the option scan the nested projects?
Even that, I went into almost all the module(core, engine, ui...) to run the same ant task. However, I still have a bunch of error within eclipse.
Some errors are : Cannot find Type java.lang.Object (which is really strange), and a bunch other not resolving.
Is there any other step I need to follow. If you have success cloning and building from the repo, please help me out here.
To update, this is what I got after following the instruction:
How to build Pentahos Kettle
Simple instructions are underneath.
Necessary tools
eclipse http://www.eclipse.org
ant https://ant.apache.org
First, execute to get latest master
git checkout https://github.com/pentaho/pentaho-kettle.git
then execute (to get stable release u need)
git checkout -b production origin/production
where production is one of names can be found (highlighted red)
u actually already may import this project into eclipse (File->Import). Better if u will assign to eclipse at least 2GB RAM (it is pretty big project). Make some changes in $ECLIPSE_HOME/eclipse.ini file:
-Xms2048m
-Xmx2048m
Now after import is done, eclipse will look this way
Highlighted:
red (default projects after import pentaho-kettle project)
blue are projects i checked out (consider version as well) and add to pentaho-kettle project in build path (Some of class missing despite they have to be in classpath according ivy)
green errors are bugs in eclipse. Those left after even I successfully build/run/execute kettle DI. Another errors are no good.
Open console (I assume ant already available on u machine and ant command already in your PATH)
cd pentaho-kettle
enter to each projects (highlighted red, except pentaho-kettle project) directories and execute
ant clean-all resolve create-dot-classpath
refresh projects in eclipse.
Note: do not execute in pentaho-kettle directory command
ant clean-all resolve create-dot-classpath
It will erase all libraries in subprojects and u will have to start from beginning.
You are done. Now start/debug kettle in eclipse (item in Run Configuration pentaho-kettle will be available)
Some of projects on image highlighted blue, they are used in pentaho-kettle (I think they suppose to be precompiled as jar files in pentaho-kettle/lib but ivy script didn't download them and didn't add them to pentaho-kettle project classpath. Eclipse will report "Some of classes are missing". I just checked them out from github manually as separate project (respect version) and add them to pentaho-kettle project in build path options
This is it.

Gradle (gradlew) does not build Eclipse path correctly trying to build spring social

I downloaded spring-social-facebook and spring-social-linked in and built the sources as per the README of the github repo for the projects
After I did ./gradlew eclipse and nce I have imported the project into Eclipse, the build path is not set up correctly.
I tried a few manual set up but did not go very far with that.
I am not a gradle user.
I found out that when you do File -> Import -> Existing projects into workspace in Eclipse, I was using the wrong directory to start from.
When you initially clone the git repository, you have a spring-social-linkedin directory created which is the one you then cd to to do the gradlew operations. And then you have a second one which is created : git/spring-social-linkedin/spring-social-linkedin.
This is this second one you need to select as the root directory to look at when you import the project into eclipse and everything will work fine.
Probably obvious for gradle knowledgeable people...

Can't run Unit tests from eclipse

If I create a test class I can't run it from eclipse until I have run it via maven on the command line first. My project build path output folder is pointing to project/target/classes. And build automatically is checked in the eclipse.
Anyone know why eclipse doesn't create the classes automatically?
Here's how the layout and build path of your project should look like.
Layout
Build path
In addition to what Marcel said, someone who runs into the same problem should look for dependencies between projects within Eclipse.
I was working with project A, which depended on project B. Project A was built and run normally, except for the problem mentioned in this post (run a JUnit class test). After digging for a while, I noticed that Project B had a build error (a source folder went missing, who knows why) and Eclipse was not building the project B, which caused an error on project A.
As soon as I fixed the project B build error, the problem with JUnit class was solved.

How can I setup ANT with Subversion and ColdFusion Builder (eclipse) to check out a local build to work on?

I am not sure if there's an answer for this already -- couldn't find one for this (hopefully common) setup:
I recently converted one of my ColdFusion projects to deploy via ANT.
I have a local ant script that instructs a remote server to check out the code, and run the application's specific build file, remotely on the server.
I have a few endpoints:
Live - production (on the production server)
Staging - on the production server, different datasource, etc.
dev - on the local box.
What I have run into it seems is a simple and common problem. I now need ANT to create any build, even locally. Fine, created a local endpoint and it configures for my box.
Issue? How do I get it to show up as a project (automatically if possible) in Eclipse/ColdFusion builder. What I envision is instead of checking out a branch via the subversion plugin in CFBuilder/Eclipse, I now use ANT to do that for me.
Since I use ColdFusion Builder (Eclipse + Adobe's plugin), I have all of eclipse's tools and plugins available to solve the problem of : how can I best call ANT from within Eclipse/ColdFusion Builder, to setup the local build as a project that I can develop and work on?
I think when I check the code back in from the local box, I'd have to be sure not to check in any files with local config paths, etc.
I hope this is a detailed and clear enough explanation, if not, please ask.
Thanks in advance!
You won't be able to have it "automatically" show up in CFBuilder, but you can make it pretty easy.
Eclipse requires the ".project" file, which is a simple xml file that by default generally just contains the project name.
Once you check out your project from SVN, Do file -- new -- ColdFusion project and point it to the directory where you've checked out your code. This will create the .project in there. From there, you can commit that file to SVN.
Subsequent developers who check out the project from SVN can then do File -- Import -- Existing Project into workspace, and point it to their checked out location. Since it'll have the .project file in there (from when you committed it), that project will show up when they search for projects in that import wizard.
Now, that's how you'd do it if you already used ANT to check out the code. However, if you wanted a potentially even easier way, then you can just install either the Subversive or Subclipse plugin into CFBuilder, and then do
file -- new -- checkout project from svn
point to your svn url
select the directory you want to check out
choose a location where you want the code to live
click through to completion