Hi everyone,

I am using maven 2.0.7 with dependency plugin versoin 2.0-alpha-4.

I have 2 projects as seen in the end of the e-mail (This are some test files
to reproduce the problem)
My first project contains a single interface that defines a String constant.
My second project, uses the String constant from my first project.

I am having issues with the dependency:analyze goal...
In all my projects, i fail the build if there is either an unused declared
dependency or an used undeclared dependency using
    <build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <phase>package</phase>
            <goals>
              <goal>analyze</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>


However, in the example below, i can not use the dependency  plugin to
achieve this..

If i add the dependency from project 2 to project 1, i get:
[INFO] [dependency:analyze {execution: analyze}]
[INFO] Used declared dependencies:
[INFO]    None
[INFO] Used undeclared dependencies:
[WARNING]    None
[INFO] Unused declared dependencies:
[INFO]    test:project1:jar:1.0-SNAPSHOT:compile
[WARNING] Potential problems discovered.


If i remove the supposedly unused dependency, then I get a compile error:
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure
C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
,24] package project1 does not exist

C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
,24] package project1 does not exist


Any help would be greatly appreciated,

Regards,
Iker



Project 1:
pom.xml:
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>project1</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
</project>

1 source file:

package project1;

public interface Names {
    /** name */
    String NAME = "name";
}



Project 2:
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>project2</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>

  <dependencies>
        <dependency>
  <groupId>test</groupId>
  <artifactId>project1</artifactId>
  <version>1.0-SNAPSHOT</version>
  </dependency>
  </dependencies>
</project>


and 1 source file:
package project2;

public interface NamesUser {

  String temp = project1.Names.NAME;
}

Reply via email to