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).
Related
I am very new to java.
I downloaded Netbeans 8.2 and Jdk 1.8 and installed both.
And opened one of the projects where I'm getting three import statement issue.
import org.apache.commons.fileupload;
import org.apache.commons.fileupload.disk.diskfileitrmfactory;
import org.apache.commons.fileupload.servlet.servletfileupload;
I have my got the below jar in web-inf/lib path in project
Commons-fileupload-1.2.2.jar
Commons-up-2.4.jar
Please guide me to get the project compiled. I am clueless since I have no idea about java and trying to run the project and debug .
Import your jar files the proper way.
Right click your project >
Properties >
Libraries
Then click the Add Jar/Folder button to import the jars you need.
After this, clean and build the project (Right click > Clean and Build), and try to run it.
Your setup probably has some sort of error to find out the path to those .jar files, it is common to happen when you've got the files imported in a wrong way.
I'd like to suggest to you to use Maven. Maven is a dependency manager and will be in charge to manage all your dependencies along the build of your project among all other features. It is easy to use and will make your life a lot easier.
Here you have two links, one if you'd like to understand better how it works (https://maven.apache.org/guides/getting-started/) and the another to help you to build your Maven project (https://maven.apache.org/guides/getting-started/). I don't use NetBeans IDE but it probably has support for Maven, but in case it doesn't, you could look for a plugin.
Hope it helps.
I have seen many questions about importing Eclipse or Gradle projects into IntelliJ, but not a question asking which approach to use. I assume just import Gradle?
We use Eclipse over Gradle, I can build and run my projects either with gradle command lines or (less likely:) in Eclipse. As long as I can build with gradle on the command line my boss is happy.
I found the fully-enabled free student versions of IntelliJ/Jetbrains products, so I am using the Ultimate version 15.02. Gradle 2.8 FWIW.
Is there ANY reason to import the Eclipse project vs. just importing the Gradle project? And I guess in the last couple versions of IntelliJ you just open the Gradle file, not import a Gradle project?
Also still a good idea to leave auto-import turned off? And I notice putting apply plugin: 'idea'; in build.gradle is no longer necessary since version 14.
I'm not an expert in the differences from importing from Eclipse vs Gradle, but I would always import from Gradle when possible (this is true for Maven and Ant base builds as well).
Which datastructure do you want Intellij to use to figure out where your sources are? You can either use the same thing Eclipse used (the build.gradle file) or you can use the product of Eclipse's interpretation of the build.gradle file.
When you import from Eclipse, you're essentially saying "Instead of getting my information direct from the build tool's setup, I'm going to get my information that got its information from the build tool." You've added another layer for no real value in the import.
That said, maybe there are things that the Eclipse project settings that project import will include. I could imagine the Eclipse project import pulling in anything like manually included jars, but this means that your project probably requires an IDE to build it (which is terrible) and really you should refactor your project so that it can be built without any IDE assistance (from the command line).
So in short, import from Gradle directly. Don't go through Eclipse. You're just filtering the source data through a filter that isn't adding any value. Or if it is adding value, then it's probably a project specific configuration that shouldn't be done in an IDE anyways.
PS.
I always just go to the build.gradle file and "open" that. Same thing for pom.xml.
I always have auto-import on, both for Maven and Gradle based projects. I've never run into any issues with it and it keeps me coding faster.
I know, this is a fairly old question, but I just wondered the same thing.
Apparently, JetBrains recommends importing the build tool file instead of the Eclipse project when possible.
If your project uses a build tool such as Maven or Gradle, we recommend choosing the corresponding option when prompted in the Import Project wizard, and selecting the associated build file (pom.xml or build.gradle) IntelliJ IDEA 2017.2 Help
I'm new to IntelliJ. What is the best (and recommend method) for importing project into IntelliJ. Is there a maven plugin for doing this?
More specially I'm interesting in importing this project.
https://github.com/nathanmarz/storm-starter?source=c
Thanks.
UPDATE 1 - When I try to use File -> open (the m2-pom.xml file) it just opens the xml file (as shown in the screenshot below.
It looks like that project has a pom file named m2-pom.xml. You should import that as a maven project. Assuming it's using standard repositories, you'll immediately be able to compile the code with maven.
You can select Open in the menu, and then choose that file and it should load the project.
Be aware this seems to be a clojure project. You might want to research the La Clojure plugin to see how/if it can import clojure projects with it. It looks like the steps I gave will work, but the code may not run very easily for you without the La Clojure plugin.
You could either import the Maven project inside of IntelliJ (File -> Import Project...), or you could simply use the Maven IDEA plugin. All you do is execute mvn idea:idea inside of the Maven directory, and a project file will be generated. This file may be opened as a project inside of IntelliJ.
EDIT: #maba warns not to use the Maven IntelliJ plugin.
I am trying to add java code from a Maven project (called docx4java) which I checked out from svn to an existing Eclipse project (called DocumentManager). I have tried the normal way, that I thought would work, i.e.:
Right Click on eclipse project>Properties>Java Build Paths> Projects > Add (here I add the Maven project) and >Libraries (here I specify Native Library location e.g. docx4/trunk/docx4/src/) but I still can't get the 'Maven' classes to be recognised in eclipse. I get the message
import docx4j.src.main.java.org.docx4j.convert.out.flatOpcXml.FlatOpcXmlCreator cannot be resolved
I have tried adding a test project that was compiled in Eclipse and that works fine, Eclipse seems to recognise it i.e. import org.me.TestProject works fine.
How can I get the code from the Maven project docx4java to work in the Eclipse compiled project DocumentManager?
You can generate eclipse poject files (which you can just import into your Workspace) using the maven eclipse plugin
Take a look at these ecplise plugins for a more direct integration of maven into eclipse
You should create a eclipse project for docx4java as #Attila has commented. Once that is done, you should have two projects on your workspace: docx4java and DocumentManager. At this point, what you are doing now (adding a project reference to the Java Build Paths) should work.
It seems that the source path is not configured correctly, this is why the compiler cannot find your "Maven classes".
docx4java.src.main.java...
Maven has a different directory structure and you have to tell Eclipse where to find your sources.
For a "vanilla" eclipse project, remove the standard eclipse build path src and add the maven source path src/main/java (or whereever you added the code), the compiler should correctly pick up your sources.
Note that you still have to add all jars mentioned in the dependencies section of the maven pom.xml file. Otherwise it won't compile, even if it finds your added java classes.
(Addendum: I would recommend to use maven in your existing project as well.)
I have two projects in Eclipse with Java and Python code, using Jython. Also I'm using PyDev. One project can import and use the xml module just fine, and the other gives the error ImportError: No module named xml. As far as I can tell, all the project properties are set identically. The working project was created from scratch and the other comes from code checked out of an svn repository and put into a new project.
What could be the difference?
edit- Same for os, btw. It's just missing some path somewhere...
eclipse stores project data in files like
.project
.pydevprojct
.classpath
with checkin / checkout via svn it is possible to lost some of these files
check your dot-files