Carsten Rohde created IVY-1511:
----------------------------------

             Summary: Ivy fails to resolve maven dependencies that were build 
with the maven-javadoc-plugin and option "maven.javadoc.skip" 
                 Key: IVY-1511
                 URL: https://issues.apache.org/jira/browse/IVY-1511
             Project: Ivy
          Issue Type: Bug
          Components: Maven Compatibility
    Affects Versions: 2.4.0
         Environment: Ant + Ivy, Windows, Java 1.6.0 32 Bit, Maven2-Repository 
(Artifactory)
            Reporter: Carsten Rohde


Given: 
************
- An ivy module that depends on a module built with Maven. 
- The Maven module was built using the maven-javadoc-plugin (inherited from its 
parent) but with "maven.javadoc.skip" set to "true", thus generating no 
-javadoc artifact.
- In general, the resolution of maven artifacts works flawlessly using the 
ibiblio resolver (m2compatible=true)

Problem:
************
- Resolution fails because ivy assumes that the -javadoc artifact is present 
which is not the case

Workaround:
************
- Exclude artifacts with -javadoc classifier

Suggestions:
************
- Include publications for maven artifacts with classifier javadoc (sources...) 
only if those files are actually present on the repository, or 
- Evaluate the maven.javadoc.skip property

Examples:
***********

Ivy-Dependency Declaration:
<dependency org="my.company" name="my-maven-module" rev="1.0.0-SNAPSHOT"  
conf="myconf"/>

Effective Maven Pom:
<?xml version="1.0"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0"; 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> 
  <modelVersion>4.0.0</modelVersion> 

  <groupId>my.company</groupId> 
  <artifactId>my-maven-module</artifactId> 
  <version>1.0.0-SNAPSHOT</version>
  
  <properties> 
    <maven.javadoc.skip>true</maven.javadoc.skip> 
  </properties> 

  <build> 
    <plugins> 
      <plugin> 
        <artifactId>maven-javadoc-plugin</artifactId> 
        <version>2.10</version> 
        <executions> 
          <execution> 
            <id>attach-javadocs</id> 
            <goals> 
              <goal>jar</goal> 
            </goals> 
          </execution> 
        </executions> 
      </plugin> 
      <plugin> 
        <artifactId>maven-source-plugin</artifactId> 
        <version>2.2.1</version> 
        <executions> 
          <execution> 
            <id>attach-sources</id> 
            <goals> 
              <goal>jar-no-fork</goal> 
            </goals> 
          </execution> 
        </executions> 
      </plugin> 
    </plugins> 
  </build> 
</project>

Generated Ivy File derived from the Maven Pom above:
[...]
        <configurations>
                <conf name="default" visibility="public" description="runtime 
dependencies and master artifact can be used with this conf" 
extends="runtime,master"/>
                <conf name="master" visibility="public" description="contains 
only the artifact published by this module itself, with no transitive 
dependencies"/>
                <conf name="compile" visibility="public" description="this is 
the default scope, used if none is specified. Compile dependencies are 
available in all classpaths."/>
                <conf name="provided" visibility="public" description="this is 
much like compile, but indicates you expect the JDK or a container to provide 
it. It is only available on the compilation classpath, and is not transitive."/>
                <conf name="runtime" visibility="public" description="this 
scope indicates that the dependency is not required for compilation, but is for 
execution. It is in the runtime and test classpaths, but not the compile 
classpath." extends="compile"/>
                <conf name="test" visibility="private" description="this scope 
indicates that the dependency is not required for normal use of the 
application, and is only available for the test compilation and execution 
phases." extends="runtime"/>
                <conf name="system" visibility="public" description="this scope 
is similar to provided except that you have to provide the JAR which contains 
it explicitly. The artifact is always available and is not looked up in a 
repository."/>
                <conf name="sources" visibility="public" description="this 
configuration contains the source artifact of this module, if any."/>
                <conf name="javadoc" visibility="public" description="this 
configuration contains the javadoc artifact of this module, if any."/>
                <conf name="optional" visibility="public" description="contains 
all optional dependencies"/>
        </configurations>
        <publications>
                <artifact name="my-maven-module" type="jar" ext="jar" 
conf="master"/>
                <artifact name="my-maven-module" type="source" ext="jar" 
conf="sources" m:classifier="sources"/>
                <artifact name="my-maven-module" type="javadoc" ext="jar" 
conf="javadoc" m:classifier="javadoc"/>
        </publications>
[...]

Workaround:
<exclude org="my.company" m:classifier="javadoc" />




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to