0

I have found this solution on stackoverflow. Warning - Build path specifies execution environment J2SE-1.4

I am getting almost the same problem but instead of 1-4 i am having 1-6. Unfortunately I don't really understand this configuration thing. It's new thing to me. I am trying second answer to get this working. I found this pom.xml in src under my project and it's xml looks like this:

<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>eu.jpereira.trainings.designpatterns.creational.singleton</groupId>
    <artifactId>singleton</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>singleton</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>


    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- Configure Build Process -->
    <build>
        <plugins>
            <!-- Compiler plugin to use Java 1.6 compatiblity -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <!-- Eclipse plugin to force download of source and JavaDoc jars -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <wtpversion>2.0</wtpversion>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
        </plugins>



    </build>
</project>

What and where should I add sth? I am using Eclipse on Windows 7. My version of java is: 1.8.0.25-b18 Words like plugin and Maven and JUnit are highlighted red. I would be grateful for help!

Community
  • 1
  • 1
user3402584
  • 410
  • 4
  • 8
  • 18

1 Answers1

0

Try

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>2.3.2</version>
   <configuration>
      <source>1.4</source>
      <target>1.4</target>
   </configuration>
</plugin>

And then regenerate the Eclipse project with mvn eclipse:eclipse.

Martín Schonaker
  • 7,273
  • 4
  • 32
  • 55