Reputation: 3557
At the moment Im trying to learn a little bit about Maven and going into IntelliJ IDEA. I set up a project and created a jersey rest backend with hibernate and mysql. I used tomcat as web container. Everything works, but sometimes I recognise that some settings in my IntelliJ project settings are deleted. Perhaps it has something to do with Maven...?
The two problems I got:
This is my pom:
<groupId>ExampleProject</groupId>
<artifactId>ExampleProject</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly2</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
Can someone help me and explain why this happens?
Upvotes: 1
Views: 3441
Reputation: 8836
The "standard" layout in a Maven web app is:
src/
main/
java/
resources/
webapp/
WEB-INF/
test/
java/
resources/
Your screenshots indicate that your setup is a little different, that's why IntelliJ may be confused and acts strangely. I suggest you create your Maven project using a predefined archetype, then import it in IntelliJ (using File -> Open
and selecting the root pom.xml
).
I've never had any problems using the standard Maven layout. Furthermore, it follows Maven's convention over configuration and it will be easier to understand for those who are used to standard Maven projects.
Upvotes: 3