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

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...

Related

Importing multimodule maven project from Git into Eclipse/STS

I have been desperately trying to import a multimodule maven project from GIT into my (freshly installed) STS 3.9.4.
During the last hours I tried lots of solutions that were posted on stack overflow, but none of them worked for me.
These are the steps I did:
git cloned the repo from the command line (intentionally, because it didn't work either when I used the GIT integration of STS)
imported the project via File / Import / Maven / Existing Maven Projects
After the project was imported, it looks like this:
(please ignore the red icon at the top left, the problems persists even when this icon is not there)
I can Run As / Maven Install any pom.xml, but when I try to edit java sourcecode Eclipse tells me The resource is not on the build path of a Java project.
To fix this I tried:
convert to faceted form
added Java nature
Configure Build Path / Set as source folder
add buildcommand org.eclipse.jdt.core.javabuilder to .project
Being able to build is fine, but editing sourcecode without support for Organize Imports, Format Source, and so on is a real pain.
From your screenshot I assume the modules are nested within the directory of the reactor pom(=parent pom) and you have imported all of them as projects (reactor and modules).
Don't add a java builder to the "reactor" project.
Make sure not to open the java files from the projects corresponding to the reactor pom, but from src folder within the corresponding module projects.
The solution to this problem was somehow hidden, but in the end I have to say the reason was clear.
After I checked with a different multimodule project (https://github.com/Activiti/Activiti.git), I was sure that my STS and other components don't suffer from a generic problem. So the cause must be located in the project itself.
The multimodule project was setup correctly on the pom.xml level. But the topmost pom.xml was modified: most of the modules had been commented out:
The developer who introduced that change didn't experience any problems because he kept his already existing workspace. And the problem only occurs when a new workspace gets created and maven scans the pom files.

are there different ways of importing git repository to Eclipse?

Why when I import a git project it does not appear like full package path view (main.java.comformance) like this image:
I have imported this project before but now in the package view, it only appears as a tree of folders and not full package path view like main.java.comformance with package icons. I wonder what I'm doing differently now. I followed the instructions in this video: https://www.youtube.com/watch?v=L8IeaWHZCRo)?
Both projects on the screenshot do not seem to be configured correctly (probably because they were not created with Eclipse or files like .project were not shared):
The project on the right side is obviously a Maven project (with probably this pom.xml file): the Java source folder should be src/main/java/ (default of Maven) instead of src (default of Eclipse) and the Java packages for instance uk.ac.manchester.cs.jfact instead of main.java.uk.ac.manchester.cs.jfact.
The project on the left side is not even configured as a Java project.
The simplest way is to use the Eclipse Smart Import feature (instead of configure everything manually): the Java nature of the project will be detected even without the .project file and also the pom.xml file is read to get the required JARs and to configure the Java build path and source folder(s) automatically:
Clone the Git repository
In the Git Repositories view right-click the Working Tree node and choose Import Projects...
Do you see the "J" in the icon next to the project name "jfact" at the right image?
That means that it is a "java" project. Eclipse does not know anything about your project.
You will have to do one of this:
Checkout the project again with Eclipse and use a "wizard" configuring it as a java project.
Enable Project Facets (right-click on the project name), and then enable "Java" in the Project Properties/Facets. This is not trivial, so I don't recommend this. - If this is a solution, actually I don't know for sure -
If you are using maven, close the project and execute mvn eclipse:eclipse to convert/create the project files for eclipse, and open again the project.
After you manage it to become a Java project, furter steps could be needed, but maybe will be enough.

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.

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

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.

Importing projects into Eclipse

I have this simple question how to import whole project source into Ecplise so I can browse it easily? Specifically, I have downloaded Maven source code http://maven.apache.org/download.html and I just want to view it same as other projects in my Eclipse.
I've tried to import it with use of two possible options (as archive and as a project) without luck.
Thank you in advance!
Maven itself is a Mavenized multi-module project, Generally there are two ways to import a Mavenized project into a IDE like eclipse:
Pre-requirment:
Suppose you have installed Maven 3 and setup environment variable
properly.
if you use Eclipse, you also need add M2_REPO to you
Build Path -- Classpath Variable, check out here for how to
setup. this tells Eclipse where to find jar dependencies stored in
local maven repository.
Option 1 -- Import as Java Project:
Open a command prompt and go to the extracted source folder, run mvn eclipse:eclipse
and waiting for it finish, make sure it doesn't popup any message start with [ERROR], this
will download all required jar dependencies from internet to you
local maven repository and create .project and .classpath for Eclipse
to use when doing import.
In eclipse, go to File -- Import -- General -- Existing Project into
Workspace, select the extracted source folder as root directory. This
will import a group of projects into Eclipse as bunch of regular java
projects (i.e. project icon inside Package Explorer watermarked with a
capital J).
Option 2 -- Import as Maven Project:
Alternatively, if yo got m2e plugin installed in Eclipse, you can
directly import the extracted project folder, go to File -- Import --
Maven -- Existing Maven Projects, select the extracted source folder
as Root Directory. This will import a group of projects into Eclipse
as bunch of Maven projects (project icon inside Package Explorer
watermarked with a Capital M).
Hope this helps.
The maven repository versions are not uploaded in the exact format they are on disc (from where the the mvn deploy goal is run. I can think of 3 options assuming I understand your question correctly:
You can find the open source project if it exists and get all the
source and project from there.
On an existing project, you go the dependencies, right click on one
and select browse source. Not the same as having the show project
here you can build and run however.
You can download the sources from the maven repo and then
reconstruct the project. I'm not not sure how feasible this
actually is and I have never tried it. I would probably find other
ways before trying this.