Maven cannot resolve dependencies correctly while compiling?
===

I am using Maven-3.0.4 with JDK-1.6.33 on Linux box, and i have a project that cannot compile with `mvn clean compile`, maven reports that some packages are not defined. So i output the debug log with the `-X` switch, found out that some dependency jar is missing from the `CLASSPATH` while compiling. The project i am compiling depends on the missing jar indirectly. 

So i tried `mvn dependency:tree` and `mvn dependency:copy-dependencies` , turns out the missing jar are resolved correctly.

The question is why the compile phrase cannot get right `CLASSPATH`? The version and configuration of both compiler and dependency plugins as following

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <encoding>UTF8</encoding>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>false</overWriteSnapshots>
                <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
        </plugin>

