Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] M2e incorrectly showing build errors in Eclipse

A maven project in Eclipse is showing build errors because it is not correctly reading the dependencies from the pom.xml file.  I know it is m2e because I can run a maven install manually without any problems.  If I had the errors Eclispe shows, maven would never pass its tests.

 

Version: Indigo Service Release 2

Build id: 20120216-1857

 

Org.eclipse.m2e.core: 1.0.200.20111223-1245

 

The imports in one of the Java files that are show “red exes”:

 

import junit.framework.TestCase;

 

import org.hibernate.Session;

import org.hibernate.SessionFactory;

import org.hibernate.cfg.Configuration;

 

The dependency nodes in the pom.xml look like this:

 

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.10</version>

</dependency>

 

 

<dependency>

<groupId>org.hibernate</groupId>

<artifactId>hibernate-core</artifactId>

<version>4.1.1.Final</version>

</dependency>

 

The pom is non-trivial but certainly not that complex: a parent with four moduals.  The moduals are all fine; only the parent.  I don’t know if this list accepts attachments but I will try to attach the parent pom file.

 

Knute Snortum

Developer

Catalyst IT Services

 

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Hibernate, Relational Persistence for Idiomatic Java
  ~
  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
  ~ indicated by the @author tags or express copyright attribution
  ~ statements applied by the authors.  All third-party contributions are
  ~ distributed under license by Red Hat Inc.
  ~
  ~ This copyrighted material is made available to anyone wishing to use, modify,
  ~ copy, or redistribute it subject to the terms and conditions of the GNU
  ~ Lesser General Public License, as published by the Free Software Foundation.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
  ~ for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public License
  ~ along with this distribution; if not, write to:
  ~ Free Software Foundation, Inc.
  ~ 51 Franklin Street, Fifth Floor
  ~ Boston, MA  02110-1301  USA
  -->
<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>org.hibernate.tutorials</groupId>
    <artifactId>hibernate-tutorials</artifactId>
    <version>4.1.2-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>Hibernate Getting Started Guide Tutorials</name>
    <description>Aggregator for the Hibernate tutorials presented in the Getting Started Guide</description>

    <properties>
        <!-- Skip artifact deployment -->
        <maven.deploy.skip>true</maven.deploy.skip>
    </properties>

    <modules>
        <module>basic</module>
        <module>annotations</module>
        <module>entitymanager</module>
        <module>envers</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.1.1.Final</version>
        </dependency>

        <!-- Hibernate uses jboss-logging for logging, for the tutorials we will use the sl4fj-simple backend -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.1</version>
        </dependency>

        <!-- The tutorials use JUnit test cases to illustrate usage -->
        <dependency>
		    <groupId>junit</groupId>
		    <artifactId>junit</artifactId>
		    <version>4.10</version>
        </dependency>

        <!-- The tutorials use the H2 in-memory database -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.2.145</version>
        </dependency>
    </dependencies>

    <build>
    	<plugins>
      		<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>
    	</plugins>
    	
        <testResources>
            <testResource>
                <filtering>false</filtering>
                <directory>src/test/java</directory>
                
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </testResource>
            
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
    </build>
 
</project>

Back to the top