You're on the right track with this, but keep in mind that IDEA's integration is import-only.
What this means is when you make changes to your IDEA project, it won't (at least with any feature I am familiar with) rewrite your POM for you. You must hand-code the POM, then IDEA will notice that you've changed it and ask if you want to re-import. There are some very convenient macros for maintaining the POM, available through the speed-menu (meta-enter). One I use a lot is "insert dependency template". As far as M2_HOME is concerned, you'd be better to set that in the Maven prefs for IDEA. It's in the Maven tab of Preferences (see https://skitch.com/t0pping/8bwrn/settings). On Feb 14, 2012, at 3:48 PM, Gogirl wrote: > How do I create the simplest Maven Project that can possibly work in > Intellij? > In Intellij, I created a pom file as a Maven Module: > > <?xml version="1.0" encoding="UTF-8"?> > <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.myCompany</groupId> > <artifactId>myProject</artifactId> > <version>1.0</version> > > > </project> > > I then used file open project and an idea project was > created. The Project file displays an .idea folder, the > typical src folder two .iml files and my pom file. > > I wrote a typical Hello World under src/main/java > public class HelloWorld { > public static void main(String[] args) { > System.out.println("Hello World"); > } > } > > With View->WindowTools-> Maven Projects I can view all the > goals that my pom created for me. > > The symbols String and System cannot be resolved by Idea. > When I try to compile from the Maven Project Window, > I am asked to define M2_HOME which I have done under system > variables with the <some.dir>\apache-maven-3.0.4\bin. > It repeats the same errors. > > All i want is to be able to use the goals I see in the Maven project > window and to see the magic of Maven from Idea. Any advice greatly > appreciated. > > -- > View this message in context: > http://maven.40175.n5.nabble.com/the-simplest-Maven-Project-that-can-possibly-work-in-Intellij-tp5483841p5483841.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org