When I'm running "mvn site" from command line (using far manageR) everything works just excellent, it downloads all the necessary jars to repository and executes tasks.
But when I'm trying to do the same (mvn site) from eclipse using m2eclipse plugin it show me:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jdbc_maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ jdbc_maven ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ jdbc_maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to G:\workspace\jdbc_maven\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[8,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,16] error: cannot find symbol
[ERROR] symbol: class Logger
location: class JdbcRoleDao
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[5,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,16] error: cannot find symbol
[ERROR] symbol: class Logger
location: class User
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[13,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,16] error: cannot find symbol
[ERROR] symbol: class Logger
location: class JdbcUserDao
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,29] error: cannot find symbol
[ERROR] symbol: variable Logger
location: class JdbcRoleDao
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,29] error: cannot find symbol
[ERROR] symbol: variable Logger
location: class User
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,29] error: cannot find symbol
[INFO] 9 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.387s
[INFO] Finished at: Sat Feb 16 11:05:13 EET 2013
[INFO] Final Memory: 7M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project jdbc_maven: Compilation failure: Compilation failure:
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[8,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,16] error: cannot find symbol
[ERROR] symbol: class Logger
[ERROR] location: class JdbcRoleDao
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[5,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,16] error: cannot find symbol
[ERROR] symbol: class Logger
[ERROR] location: class User
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[13,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,16] error: cannot find symbol
[ERROR] symbol: class Logger
[ERROR] location: class JdbcUserDao
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,29] error: cannot find symbol
[ERROR] symbol: variable Logger
[ERROR] location: class JdbcRoleDao
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,29] error: cannot find symbol
[ERROR] symbol: variable Logger
[ERROR] location: class User
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,29] error: cannot find symbol
Here is my pom.xml
<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>jdbc_maven</groupId>
<artifactId>jdbc_maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jdbc_maven</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.169</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.6</version>
<configuration>
<configLocation>sun_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.6.1</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<!-- JDK 1.7 COMPILER - DON'T TOUCH -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>${env.JAVA_HOME}/bin/javac</executable>
<fork>true</fork>
</configuration>
</plugin>
<!-- JDK 1.7 COMPILER - DON'T TOUCH -->
</plugins>
</build>
</project>
This sometimes happen with m2eclipse , its because as you add new dependencies to the pom.xml , m2e will automatically add it to classpath and this classpath generation has some issue.
well a quick and dirty way to fix would be to
Remove the project from the eclipse
navigate to the project folder
and delete .settings directory and .classpath file
Import the project into the eclipse
as a 'Maven Project'