I am trying to import a project in Eclipse. The other person working on this project uses IntelliJ.
The project is a Maven one, but when I import it using the File > Import > Existing Maven Project menu, the packages in src are displayed as normal folders, and I get errors saying that the package definition in the java files are wrong.
I tried to import the project as a normal Java project (by creating a new Java project and changing the default location), but I get the same result.
I tried to look for other .project files that might conflict with my version of Eclipse, but there is none.
I tried to delete every file related to IntelliJ, but it did not change anything.
I also tried to remove the .metadata directory of my Eclipse workspace and then import the project again, but still got the same result.
Finally, I tried to run the commands mvn eclipse:clean and mvn eclipse:eclipse but nothing changed.
There is a .classpath file in the project, so I don't see why the packages are not recognized as pasckages.
I am now out of option and completely stuck until I figure this out.
Related
I have been assigned to a project that builds some Eclipse plugins. There is a root pom.xml, and maven builds it successfully. But when I load it into VSCode, with the Java Pack (vscjava.vscode-java-pack) loaded, and load the Java projects, many files produce errors like
The declared package "com.correct.package" does not match the expected package ""
and
The import com.something cannot be resolved
even though maven just built the packages just fine.
Now the obvious reason why it might not work is that the tycho-pomless extension is installed and most of the sub-packages only have .project, build.properties and plugin.xml, but no pom.xml.
Is it possible to generate all the pom.xmls or something else that the VSCode plugin would understand to set the correct package roots and classpaths?
Right click the folder which contains the folder com and choose Add Folder to Java Source Path. Try this and see if the question goes away.
I have an existing maven project which I downloaded from GitHub.
If I run mvn clean install from the root of the project everything works fine (a jar file is created in target folder and it executes works OK).
But when I go to Eclipse and import this project as Existing maven project I get multiple (395 to be precise) Java Problem errors (like The method is undefined etc.).
The only thing that I notice is when I run maven from command line it creates .m2 folder inside the project folder while maven from Eclipse creates .m2 inside my C:\Users\username folder.
I'm using Eclipse 2019-06, Java 8 and apache-maven-3.6.1.
P.S. Same errors appear when I import this project to Intellij IDEA 2019.2.
Olga, don't worry. Import the project into Eclipse. Then wait some minutes. If the errors do not vanish, try "ALT + F5". If this still does not help, build the project from within Eclipse ("Run As -> Maven build"), do "ALT + F5" again.
Eclipse often takes some time to fully "understand" the project, i.e. synchronise the POM and the files to its internal mechanisms.
In a couple of our new projects, we were committing .settings, .classpath, .project into git. I recently removed all of these from the app and added them to the ignore file.
Now we have a problem, when we import the Maven project it now uses the wrong facets. It also doesn't create one of the .settings files we need.
It imports the facets including me.hibernate 4.1 instead of jpt.jpa
2.1
It also isn't creating this settings file on import any longer either: org.eclipse.jpt.core.prefs.
UPDATE
Interesting scenario:
With a fresh workspace..
If I clone Project A and do a maven import, it imports with the wrong settings. If I delete those settings files and remove the project from the workspace, import it again, it now imports with the correct settings.
If I now clone Project B into that workspace and maven import it, it has the correct settings files.
Now with ANOTHER new workspace I import Project B first and it has the WRONG settings files, just like Project A did. I delete those files and import project B again to the same workspace and now it has the correct settings. Now if I clone project A into that workspace and import it, it has the correct settings files.
So now the question is, what makes Eclipse import the project ONLY the first time?
I'm trying to import a GitHub project, specifically, this one : timtiemens/secretshare using IntelliJ Idea.
The git import works fine, at which point the IDE builds the project using gradle, which works fine.
However, when I actually open the project, only the gradle directory in the project is opened, ie, .../secretshare/gradle. The other directories, like src, are just not there in the IDE, even though they're present in the project folder - I can see them with explorer.
Just Delete the idea files created by inteillj
Run gradlew idea
Open the project again and choose use gradle wrapper settings.
I have a GWT project, which builds under Eclipse, but I am trying to migrate it to IntelliJ.
I appear to have imported it correctly, downloaded all the required libraries using maven / pom.xml, but when I try to make the project, I get the following error:
java: package com.infoshare.clearcore.shared.model does not exist
If I browse the sources, it is there, but using any of the IDE "goto" options fail.
The picture below shows the project structure, which has two modules one with the failing (auto generated) source code, and the other with the "com.infoshare.clearcore.shared.model" code. Is there some way I can tell the compile to look in both modules, or do I have to restructure the code?
How did you import the project? The best way I found to import Maven projects is simply to open the root pom.xml using File > Open, then IntelliJ will detect the project and import it automatically.
Eveything should be configured properly. in particular, the target folder should be displayed in another color, because the IDE knows it contains generated files (which is not the case in your current screenshot).