#692 Trouble with dependency plugin

svn
closed
nobody
5
2014-03-13
2014-03-13
No

It seems like that in mycore-base there is a new maven-plugin to check, if dependencies are atually used. But for example, the mysql-Driver is never used in an import statement.

<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
     <execution>
        <id>analyze</id>
        <configuration>
          <usedDependencies>
            <!-- used by jdom 2.0.5 -->
            <useDependency>jaxen:jaxen</useDependency>
            <!-- used by commons-vfs -->
            <useDependency>com.jcraft:jsch</useDependency>
            <!-- used by svnkit -->
            <useDependency>net.java.dev.jna:jna</useDependency>
            <!-- used in hibernate tests -->
            <useDependency>org.hsqldb:hsqldb</useDependency>
            <!-- used by hibernate -->
            <useDependency>org.slf4j:slf4j-log4j12</useDependency>
            <!-- used by hibernate -->
            <useDependency>org.javassist:javassist</useDependency>
            <!-- used for XML catalog resolving -->
            <useDependency>xml-resolver:xml-resolver</useDependency>
          </usedDependencies>
        </configuration>
      </execution>
    </executions>
  </plugin>

Class.forName("com.mysql.Driver");

So this plugin seems to check, if dependencies are used and for quite a lot of dependencies (jaxen, mysql-driver, jcraft, jna, hsqldb, slf4j, javassist, jersey and xml-reader) the dependencies are not needed at compile time.
As the plugin detects it, it stops the build.

Here are two solutions proposed:
http://stackoverflow.com/questions/4919297/how-to-tell-maven-dependency-plugin-that-the-artifact-is-used-in-the-project

One solution is to change to the scope from "compile" to "runtime". The other one is to set the ignoreNonCompile option.
I chose to change the scope of all affected dependencies.

<dependency>
  <!-- required by jdom 2.0.5 -->
  <groupId>jaxen</groupId>
  <artifactId>jaxen</artifactId>
  <scope>runtime</scope>
</dependency>

It fixed the build-process. I attached my mycore-base/pom.xml.

1 Attachments

Discussion

  • What is the problem? MyCoRe builds fine here and at Jenkins. What part does MySQL play here?

     
  • Actually, I can't reproduce this problem anymore.
    I did a SVN-revert on my pom.xml and now it works. But in the past it crashed though I didN't touch it. I has to change the things as I described to get it running.
    Strange,... Sorry for that disturbance :/

     
    • status: open --> closed