I'm trying to create a simple Java webapp using IntelliJ (v11.1.3) and integrate it with a simple maven pom file to download the Vaadin jar.
Here is my pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.a.maven.project</groupId>
<artifactId>MavenProject</artifactId>
<version>0.1</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.8.2</version>
</dependency>
</project>
I am checking this project out from version control in order to set it up in IntelliJ. However, IntelliJ does not seem to be able to recognize that the "src" folder is the sources folder. I can manually set this to the sources folder in the project settings, which is a minor annoyance, but not a big deal. However, EVERY time i make a change to the pom file, IntelliJ "forgets" that this is the sources folder, and then all my Java files get red circles around them. Does anyone have any idea as to what could be causing this? I've tried just about everything to fix this, including specifying the source folder in my pom file, but nothing seems to work.
Thanks in advance,
Eric
From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Modules. Select the necessary module and open the Sources tab. next to Source Folders or Test Source Folders. Specify the package prefix and click OK.
If the dependencies weren't imported correctly (IntelliJ IDEA highlights them), try to perform the following actions: You can check your local maven repository in the Maven | Repositories settings and try to update it. You can check the jar file of the local . m2 repository to see if it was downloaded correctly.
It happened to me on Idea 11 that everything was ok, but sources were not recognized. I opened that project as maven - from parrent pom - and selected delete existing idea files and generate new. It worked then.
IntelliJ IDEA follows Maven conventions and will automatically configure /src/main/java
as Sources root.
In case you are using non-standard directories for the sources, check IDEA Maven FAQ for the workaround:
<sourceDirectory>...</sourceDirectory> will be added as Source folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With