0

My mvn -v prints the following :

>    Maven home: D:\apache-maven-3.2.1
>    Java version: 1.7.0_55, vendor: Oracle Corporation
>    Java home: D:\Java\jdk1.7\jre
>    Default locale: en_IN, platform encoding: Cp1252
>    OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

My POM.xml is as follows:

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.sample sample war 0.0.1-SNAPSHOT Maven Webapp http://maven.apache.org

<properties>
    <spring.version>4.1.2.RELEASE</spring.version>
    <junit.version>4.11</junit.version>
    <hamcrest.version>1.3</hamcrest.version>
    <mockito.version>1.10.8</mockito.version>
    <jackson.version>2.4.3</jackson.version>
    <jwebunit.version>3.2</jwebunit.version>
    <jstl.version>1.2</jstl.version>
    <servlet.version>3.1.0</servlet.version>
    <jsp.version>2.3.1</jsp.version>
    <xml.api.version>1.4.01</xml.api.version>
    <hibernate.version>4.3.7.Final</hibernate.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    <hibernate.validator>5.1.3.Final</hibernate.validator>
</properties>

<dependencies>

.....

</dependencies>

<build>
    <finalName>AcmeWeb</finalName>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>
        </plugin>
    </plugins>
</build>

I have removed the dependencies as it is a big list, and have given only portions that may be relevant here. If required I can print the full list.

When doing a Mavan install from my eclipse IDE, am getting following error :

"[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project sample: Fatal error compiling: invalid target release: 1.7 -> [Help 1]"

Can someone please help me where I am wrong.

My JAVA_HOME is set to "D:\Java\jdk1.7\jre".

Thanks & regards

Yuva

Jens
  • 67,715
  • 15
  • 98
  • 113
Yuva
  • 2,831
  • 7
  • 36
  • 60
  • Do you used the embedded or the external Maven in Eclipse? – SubOptimal Jan 19 '15 at 13:28
  • See http://stackoverflow.com/questions/14043042/compiling-java-7-code-via-maven – pringi Jan 19 '15 at 13:34
  • Check what is the installed JRE in Eclipse settings, is it the same JDK 7? – eis Jan 19 '15 at 13:39
  • Thanks for you response. I was trying to import a maven project into my workspace and here am getting this error. My JRE is pointing to JDK 7. Please help me. Thanks – Yuva Jan 20 '15 at 06:45

1 Answers1

1

Change your JAVA_HOME to point the installed JDK (Not JRE)

I mean your mvn -v should display as Java home: D:\Java\jdk1.7

Manmay
  • 835
  • 7
  • 11
  • Thanks Manmay, the JAVA_HOME was pointing to JDK1.7 home, but changed it to point to JRE as suggested in some of the solutions, now I changed the JAVA_HOME as suggested by you, but still the same issue. Please help me resolve the issue. – Yuva Jan 20 '15 at 06:49
  • when you execute mvn --version are you getting the new path as JAVA_HOME in the result ? Please put the result here. – Manmay Jan 20 '15 at 08:11