You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gogirl <cl...@gmail.com> on 2012/02/14 21:48:39 UTC

the simplest Maven Project that can possibly work in Intellij?

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: the simplest Maven Project that can possibly work in Intellij?

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 14.02.2012 21:49 schrieb "Gogirl" <cl...@gmail.com>:

> The symbols String and System cannot be resolved by Idea.

Make sure you define a Java SDK in your project settings.

Re: the simplest Maven Project that can possibly work in Intellij?

Posted by Cem Koc <ce...@gmail.com>.
Simplest way

* mvn archetype:generate
It helps you create a demo project. Read here [1]
* At idea: File, new project, import from external resource, and select your
created project folder.

You can run your goals.

[1]: http://maven.apache.org/archetype/maven-archetype-plugin/usage.html 

--
View this message in context: http://maven.40175.n5.nabble.com/the-simplest-Maven-Project-that-can-possibly-work-in-Intellij-tp5483841p5485336.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: the simplest Maven Project that can possibly work in Intellij?

Posted by Brian Topping <to...@codehaus.org>.
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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org