Project files are not imported after importing the project in Eclipse Luna - eclipse

I am new to scala as well as Eclipse. Please be smooth on my question. I looked mostly on all available resources of eclipse.
I am using Scala IDE in Eclipse. When I am importing the project into Eclipse(General->Import Existing Project...), then the project is imported, but main files in src/ as well as in test/ are not imported and they are present in project directory.
Here is the screenshot of the eclipse. Can anyone help me with this?
main/ and test/ are empty, but they contains the project file.

Even though source and class path resources may reside with the src/main/scala and src/test/scala folders under your project on the file system, Eclipse separates them off in the Package Explorer view and shows them in a separate part of the tree decorated with a little package icon.
See the first item in the tree under progfun-example.
Hopefully your source will be there. (The presence of the tree expansion toggle icon would indicate that there is something there.)

Related

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.

Multi module maven project is not showing in package structure but as folder structure in eclipse

I have successfully imported a multi module maven project from GitHub into my eclipse and able to build it successfully.
But the problem is project is being shown in folder structure but not as package structure which is making my day tedious.
Could anybody else faced this issue? Please do suggest your ideas.
Check out if the Project view in hierarchical mode would be a better fit for your need.
See Eclipse 4.5M5:
The Project Explorer now provides the ability to view the projects in a hierarchical (a.k.a. nested) form.
For modular projects, this allows to have your Project Explorer mapping more closely the organization of your modules as they are on the file system.
This hierarchical view of projects often makes easier to navigate modular projects.
Hierarchical view of projects can be triggered from the Project Explorer view menu, under the Projects Presentation item.
Then it makes the folders that are at the same location as a project replaced by the project, and the projects that are nested under other projects will not be shown as root elements.
In the folder where you have downloaded the project from git, you will see a .project file. You need to provide buildspec and natures information in that xml file.
In my case the .project xml file looks like this -
Now, make sure that you have provided the buildspec and natures information as shown in example above.
Once you have made the changes to .project xml file -
Right Click the Project >> Refresh
Right Click the Project >> Maven >> Update Project
You will see that the project (source) folder structure is represented in desired format.

Why doesn't Scala IDE recognise my Scala packages?

I have a project containing our Gatling performance tests. I've imported the Maven project into Scala IDE, and I can see that the project has a Scala nature.
However, when I look at the package tree in the package explorer (it's located in src/test/scala), I see the regular folder hierarchy instead of it being flattened by package:
Furthermore, automatic imports, ctrl+click and basically every other IDE feature do not work.
What would I have to configure?
(I'm not that familiar with both Scala and Maven, so I'm not quite sure what other info is relevant here - do enlighten me if I missed anything.)
Right Click -> Build Path -> Use as Source Folder.
Any folder can become a source folder by adding it to the Java build path. Build path is basically "stuff" (jars, files and folders) that compiler will consider when compiling your source files.

Maven in eclipse not showing all folders

I am new to Maven and have been trying to get a project working with Eclipse, hibernate,Maven and mysql. I am stuck at the very first step. I have everything configured properly i think and if i create a new Maven project in eclipse it does not show me any folder under src/main or src/test. although if i go back to that folder in the workspace it has a src/main/java
FUrthermore the src/main/resources folder is not created at the time of project creation?
Any clue what the problem maybe or how i can fix it?
Thank you!
For your first problem, when you create a new Maven project the folders that get created depend on the archetype you choose. Assuming you chose quickstart, then it does create (assuming you chose com.example as your package in the wizard and example-project as your artifactId):
And it configures the project so that /src/main/java is in the Build Path. That said, if you are viewing your project in the Package Explorer view, then the packages are shown outside of the folder structure. So, you would see the the com.example.example_project package containing App.java in the build folder /src/main/java and you would see the com.example.example_project package containing AppTest.java in the build folder /src/test/java. These would show up above the libraries which is above non-build folders which is where you see the src folder.
To answer your second question, no, /src/main/resources is not generated assuming you chose the quickstart archetype (this is governed by the quickstart archetype and does the same thing whether generated in eclipse or on the command line).
And third, to fix this (I assume you mean add the resources folder), find the src/java folder (below the libraries), right click and choose New->Folder. Name it resources. Then right click your project, choose Maven->Update Project. This will cause maven eclipse to reconfigure the project according to the Maven configuration which will result in the /src/main/resources being added to the build path. As such, it will get moved above the libraries next to /src/main/java and /src/test/java.

Errors in exporting eclipse deployable plug-ins and fragments

I have an eclipse plug-in working fine within eclipse environment.
I wanted to export it into a jar file, so I chose Export > Deployable plug-ins and fragments.
I could get a jar file, but an error was reported.
Opening the log file, it reports that I have 1242 problems (191 errors, 1051 warnings). This is some copy from the error log.
2. ERROR in /Users/LSclipse/src/lsclipse/LSDiffRunner.java (at line 61)
import edu.washington.cs.induction.OnePipeLineScript;
^^^
The import edu cannot be resolved
----------
3. ERROR in /Users/LSclipse/src/lsclipse/LSDiffRunner.java (at line 261)
OnePipeLineScript.getMatchingForRefFinder(projName, proj1, proj1Loc
^^^^^^^^^^^^^^^^^
OnePipeLineScript cannot be resolved
Why I got errors? I had 2049 warnings, but no error when I compile the plugin in eclipse IDE.
ADDED
The main project references two other projects, and references many external libraries. I attach the package view and Java build path.
There were multiple issues involved for this problem. However, the core issue was that the project apimatching and originanalysis were not eclipse plugins but just java projects. As a result, those two projects were not included in the final jar file to break the build.
Symbolic linking the two projects into the main project
I solved this issue by symbolic link the src directory into the main eclipse plugin project.
ln -s /workspace/seal/edu.ucsc.originanalysis/src /LSclipse/originanalysis
ln -s /workspace/seal/edu.ucsc.apimatching/src /LSclipse/apimatching
From the Java Build Path/Source tab, I added those two included projects as source. Eclipse Java Missing required source folder: 'src'
Now I have eclipse plugin jar file without error.
Then click F-5 to refresh the project explorer and check they are java src directory.
Select the included projects in Build tab.
Updating bin.include and source.. in build.properties tab is important. One should understand that in bin.include the ordering is also critical. lib/cdtparser.jar and lib/cdtcore.jar should be placed prior to the user of them - origin analysis/.
Copying jar files for included project into main project
I also had to copy some jar files in those projects file into the main project, and select them in Binary Build tab.
And add tim in Runtime/Classpath tab.
Select the JavaSE-1.6 in Execution Environments.
I have lots of "Must Override a Superclass Method" errors. With the hint from this post - 'Must Override a Superclass Method' Errors after importing a project into Eclipse , I removed the J2SE-1.5 to resolve this issue.
You can not add third party libraries into class path of Java when developing a plug-in. It is the way to build standard Java application, but plug-in is a kind of OSGi bundle that has itself rule for class loading.
The correct way is adding third party libraries into the class path of your plug-in.
Add below declaration into MANIFEST.MF of your plug-in,
Bundle-ClassPath: lib/log4j-1.2.7.jar,
xml-apis.jar,
...
Check those links [1], [2] for understanding it.
This is what have a question on and see as potential solutions to potential problems.
Is this class comfing from a referenced jar or is it in the actual plugin edu.washington.cs.induction.OnePipeLineScript;
You seem to have a lot of soure folders and wondering if your build.properties file is showing any warnings and that you also have this defined for each of the source folders in your build.properties source.. = src/
Your external jar libraries appear to be in a folder that is of type source which is not correct. It should be a non-source folder (which you can tell a source folder by the package icon decorator) and you should make sure in your manifest editor that for runtime you have the lib checked so that it includes the jars in the build. To unmark it as a source folder select the drop down menu in your navigator view go to filters and uncheck .resources which will then show the .classpath file in that file you will see the folder to be kind="src" (i believe) remove that.
Somehow it also looks like you have linked source folders which is a practice I would not suggest and am not sure if that will cause problems when exporting the plugin. If you can avoid linked source folders that would be better.
Also it seems like you are confusing java build path configuration for plain java applications with plugins running in OSGI which is not configured through java build path but your manifest.editor So as a rule of thumb if its a plugin don't even bother trying to configure the java build path because OSGI is different, that could be causing issues as well
Select "Use class files complied in the workspace" in Options works for me.