Project not built. Build path incomplete. Repairing build path did not work - eclipse

java version "10.0.1"
Eclipse jee 2018-2019
Windows 10
I'm just trying to add a simple file to my package. After adding the file, I get the below error.
The project was not built since its build path is incomplete. Cannot
find the class file for groovy.lang.GroovyObject. Fix the build path
then try building this project.
Pretty much all posts say to delete the JRE System Library and add it again, do a refresh, clean restart. I did this, but I'm still getting a build path error.
I followed these instructions. Other forums on stack say similar things.
http://hemant-vikram.blogspot.com/2012/07/eclipse-build-error-project-was-not_12.html
New to Eclipse and Groovy. I just want to follow the tutorial :|

If you have added references to Groovy types, you can add Groovy libraries to your classpath by right-clicking on your project and choosing "Add Groovy Libraries to classpath". This assumes you have Groovy Development Tools installed.
Or you can add "org.codehaus.groovy:groovy-all" through Ivy, Maven or Gradle if you are using one of those for dependency management.

Related

Define a Java 9 multi-moduled project in Eclipse

I'm trying out Java 9 Jigsaw module system (no module experience yet) and would like to use it for capsuling the classes within my project, but it's confusing.
According to this article it should be possible to have multiple modules within ONE project. I made a new project in Eclipse Oxygen (Java 9 is supported) with the same structure as shown in the article. But Eclipse keeps telling me that I must not have more than one module-info.java in a project.
I really don't know how to tell Eclipse that it should use the "multi-module-mode". And I really would appreciate not having to create a new project for every single module.
This works:
This not:
But according to this article something like that should work:
And how about deployment of a modularized project with Eclipse? There is nothing to see about the new jmod extension. Do I still export it as a runnable JAR file like before?
Notice that my questions refer to working with the IDE (no command line, I mean with an IDE that should be possible, right?) Thank you for enlightening me.
Currently, Eclipse requires you to create a separate project for each module (e. g. because each module has its own Java Build Path).
To understand this design decision, consider that Java modules correspond to OSGi bundles / Eclipse plug-ins and it has always been to have a separate project for each bundle/plug-in. If you come from the Maven world, you would probably expect a deeper folder structure instead. But modules are self-contained and combining several modules into one project would only add an additional folder level without meaning. However, Eclipse supports nested projects and so-called working sets if you need an additional folder level.
Exporting modules as images is planned for Eclipse 2019-03 (4.11), on March 20, 2019 (see Eclipse bug 518445). Exporting modules as JARs that can be used on the modulepath (-m) already works (see my video).
I don't know if this question is still open for an answer, but you can solve this problem by simply removing all source folders on the build path. At least this works for Eclipse 2021-12 version.
As you can see this is a demo project from the Official Gradle Guide Book and it has multiple modules. Each module has its own module-info.java.
project structure in IntelliJ IDEA
If I open this project in Eclipse it will give me the 'duplicated entries on module-info.java' error.
Eclipse shows the error
But if I delete all the source folders on the build path, the error is gone and the project can be built and run without problem.
project properties: Java build path
The only problem is that you have to build the project with Gradle so that it will produce the .jar of each module and you have to include them in the libraries later.
include all the .jar in libraries
I think this is probably the same solution mentioned by howlger above.

Kotlin And Java In The Same Project Using Eclipse IDE

I posted a similar question regarding gradle but this question is without gradle or maven.
I can not get Kotlin working properly using Eclipse IDE. This works great using IntelliJ, however many developers still use Eclipse. I have installed the Kotlin Eclipse plugin and does not work. I have downloaded the Kotlin standard library and runtime library and added them into the project. Still not working. All I get in eclipse when I have Java and Kotlin is cannot be resolve to a specified type.
I'm not using maven or gradle because I couldn't get it working with those two either.
If I mix Java and Kotlin in the same source folder I get this error.
"The type error.NonExistentClass cannot be resolved. It is indirectly referenced from required .class files"
I'm using Eclipse Neon. If anyone can help me that would be awesome, I've been trying for quite some time now and not getting anywhere. :(
Add Kotlin Nature fixes the issue. Click on your project and Configure
Kotlin -> Add Kotlin nature
This partially fixes the issue, though eclipse plugin is still buggy and auto import function still doesn't work for me.
If you're having any issue, make sure you have kotlin_bin folder added in your project. Also make sure that ALL kotlin files have the correct package name sometimes when you rename packages or move files around kotlin classes may not get updated.
Got similar issue solved by adding a new Kotlin file to a Kotlin/Java mixed project. Adding the file caused Eclipse 2018-09 (4.9.0) to add kotlin-stdlib.jar and kotlin-reflect.jar to classpath and everything started working.
Add Kotlin Nature fixes the issue. Click on your project and Configure Kotlin -> Add Kotlin nature
As of the current Eclipse version (2019-09):
You can't add Kotlin to a Java project, but you can add Java to a Kotlin project.
The procedure to accomplish a mixed Kotlin/Java project was roughly:
Install Kotlin plug-in
Create empty Kotlin project
Move the Java code into the Kotlin project
Delete the original project
Fix project references
I'm working on a project with Spring Boot and Kotlin (some controllers/mappers/classes in Java and others in Kotlin) and after trying a lot of approaches, the only that worked was to use Eclipse 03-2020 and Kotlin Plugin for Eclipse V0.8.19.
https://dl.bintray.com/jetbrains/kotlin/eclipse-plugin/0.8.19/
Before everything, close your project and uninstall the previous version of Kotlin Plugin for Eclipse.
Go to Help/Install New Software.
Copy the link of Eclipse Plugin and continue with the installation (do not forget to check all the options to install).
After the installation restart the IDE and try compile again.
If your project was like mine, it has .kt files in /src/main/kotlin, some missing references in Java. I tried compiling them but nothing worked. It turns out that my project didn't have an Eclipse Source Folder associated with the kotlin code. There were the usual ones for "src/main/java", "src/main/resources" but not one for "src/main/kotlin".
So, I created a source folder for the kotlin files.
Right click the project
New "Source Folder"
Specify folder name: "/src/main/kotlin"
This doesn't create anything in the file system but just creates a logical container for Eclipse to work with the contents. In this case, Eclipse recognized the .kt files, compiled them and all the missing references issues all cleared up.

How to add a library into Processing from Eclipse platform?

I installed the Processing plugin for Eclipse. it works fine. But then i copied the folder gifAnimation into C:\Program Files\eclipse\plugins\processing.plugin.core_0.2.5.1\Resources\libraries. All the other libraries are there.
but "import gifAmination.*;" does not work.
and gives the following error.
Library import "gifAnimation" could not be found. Check the library folder in your sketchbook.
It's been awhile since I used Processing in Eclipse, but I think you need to add libraries explicitly to the build path. There is a tutorial here which will walk you through the whole process of getting Eclipse working with Processing, including adding extra libraries. The main thing you need to do is browse to your added libraries, and use Eclipse's 'Add to Build Path" menu option.

How to import playframework sources into eclipse?

After cloning playframework from github and importing java sources into eclipse there are a lot of build errors shown.
Running the goals from ant file in eclipse works fine as well as building from cli directly.
How can i resolve these errors in eclipse?
I took the following steps to import play into eclipse:
new -> other -> Java>New Java Project from Existing Ant Buildfile
select play/framework/build.xml
checking the 'Link to the build file in the file system' checkbox
Finish
The errors result from differences between eclipse internal build path
and classpath available for ant at runtime.
First Eclipse only imports rt.jar from system path. This may lead to
missing dependecies in javax.net packages (e.g.
javax.net.ssl.SSLException), which is located in jsse.jar. To fix, right
click on project->Properties->Java Build Path->Libraries->Add Library->
JRE System Library.
Second, play has dependencies to classes from ant runtime. To fix, right
click on project->Properties->Java Build Path->Libraries->Add
Library->User Library
There you have to add a new User Library (perhaps call it ANT) and add
all ant-jars from your ant installation (/usr/share/ant/lib/ worked for
me). Then add this user library to play projects build path.
From the Oliver's answer, I had also to add the jce.jar lib in my classpath.
It comes from the $JDK/jre/lib directory.

cmake, add_subdirectory without adding it to the generated project file?

I have a project that is build with cmake. In my cmakelists I have a
add_subdirectory(externals/foo)
to build the dependency "foo" which has it's own cmakelists.
Now it is so that also the whole foo sources and headers are included in the generated Project file (I'm using Eclipse). But all I want is to only have my project available in Eclipse (Eclipse has problems with subprojects in the same folder structure).
So that the cmakelists from "foo" is only used to build "foo" automatically and link it to my project. I don't want to see it in my IDE however.
Is this possible? If yes: How?
When I use Eclipse with CMake, I create the Eclipse project manually (with the New Project wizard) and for CMake I use the standard makefile generator. It requires a little extra setup: you need to set the build directory in the project properties if you're doing an out-of-source build, and I usually set the build command to make VERBOSE=1.
I'm not sure since I haven't used the Eclipse generator(s), but for the lack of a better solution, perhaps this method would solve your issue, since it gives you more control over the Eclipse project.
No, how should the ide know what to compile if you don't tell it what to compile? If you don't want to have the project in you project file, just don't add it.
Just compile the external lib by itself (use "cmake externals/foo") and then add the libraries in your project's CMakeLists.txt with
target_link_libraries(your_project externals/foo/bin/foo.lib)