0

I'm tring to create a webapp with maven on, I followed this guide: http://www.youtube.com/watch?v=YeC7XQho-O0

When I create the project it say this warning:

There are no JREs installed in the workspace that are strictly compatible with this environment.    testM6      Build path  JRE System Library Problem

My .pom file is

<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>ac.web.test</groupId>
  <artifactId>testM6</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

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

  <dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

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

when I try to switch to this build tag:

<build>
  <plugins>

    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0</version>
    </plugin>

   </plugins>
  </build>

I get this warning:

 Description Resource Path Location Type
 Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
 testM6 Build path JRE System Library Problem

What I miss?

Thanks much to all

I resolved with this Warning - Build path specifies execution environment J2SE-1.4

but I did not understand why it does not automatically

Community
  • 1
  • 1
Andrea Catania
  • 1,361
  • 3
  • 21
  • 37

2 Answers2

1

Eclipse is creating your build path based on your POM file. Including the JRE system library. In your configuration of the compiler plugin you specified that your source code is Java 1.4 compliant and that you wanted it to be compiled as Java 1.4 compliant. Eclipse warns you that it has no perfect match with a "build path warning" in your Markers view. Maven will do the same when run. If you did not configure the Eclipse run-configuration for your maven build with a JDK 1.4, then Eclipse will pick whatever JDK is available (default JRE) to run Maven and Maven warns you about the fact that it may not produce what you expected.

If you have a JDK 7 configured in Eclipse, then you need to set the following as the configuration of the compiler plugin:

<configuration>
    <source>1.7</source>
    <target>1.7</target> 
</configuration>

After you have done that, the warning should go away. Both the Eclipse Marker and the warning that Maven spits out when run.

Ralf
  • 6,735
  • 3
  • 16
  • 32
  • I solved with adding the code. It's correct to add tomcat plugin with "maven-compiler"? – Andrea Catania Dec 18 '13 at 16:02
  • If you need the tomcat plugin depends on what you want to achieve. If all you want is to deploy and run a web project with standard maven layout in a tomcat from within Eclipse, then you do not need the Tomcat Maven plugin. The Eclipse m2wtp plugin will take care of that. – Ralf Dec 18 '13 at 17:29
  • have you a link where can I know what is maven plugin? – Andrea Catania Dec 19 '13 at 08:16
  • Just google for tomcat7-maven-plugin and you should find what you are looking for. – Ralf Dec 19 '13 at 08:24
0

I see you have java 1.5 installed in your system and you are trying to use Tomcat 7. According to this link the minimum requirement for running Tomcat 7 is java 1.6.

Udi Cohen
  • 1,259
  • 9
  • 12