How Can I deploy a Multi Module Maven Project with a docletArtifact as a self referencing dependency?

StackOverflow https://stackoverflow.com/questions/19371329

  •  30-06-2022
  •  | 
  •  

Question

I have a Multi-Module Web Application project like so:

Parent

  1. Web-Base
  2. auth
  3. doc
  4. ADFS
  5. Test-Site

Test-Site uses all the other modules just fine.

doc combines JavaDocs and mounted Web Page information to build a SiteMap. Because It's parsing the JavaDocs for my SiteMap Generation It's also a Doclet Jar, since a Doclet was the easiest way to parse and store the info for the site map.

In Test-sites pom.xml I have

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <version>2.9</version>
  <executuions>
    <exceution>
      <id>build-siteMap-Descriptions</id>
      <phase>process-classes</phase>
      <goals>
        <goal>javadoc</goal>
      </goals>
      <configuration>
        <doclet>
          us.ak.state.revenue.cssd.utils.SiteMapDoclet
        </doclet>
        <docletPath>
          \;.;${project.build.outputDirectory};
        </docletPath>
        <docletArtifacts>
          <docletArtifact>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <version>1.6.2</version>
        </docletArtifact>
        <docletArtifact>
          <groupId>us.ak.state.revenue.cssd</groupId>
          <artifactId>doc</artifactId>
          <version>${project.version}</version>  <!-- problematic section -->
        </docletArtifact>
      </docletArtifacts>

      <bootclasspath>
         \;.;
         ${bootClassPath};
         ${env.CLASSPATH};
      </bootclasspath>

        <destDir>SiteMap</destDir>

        <author>false</author>
        <!-- don't print the packages/classes it's running on -->
        <quiet>true</quiet>
        <debug>true</debug> <!-- save options -->
        <useStandardDocletOptions>false</useStandardDocletOptions>

        <additionalparam>
          -sitemap us.ak.state.revenue.cssd.webBaseTest.Pages.SiteMap
        </additionalparam>

        <name>SiteMapDoclet</name>
        <description>Page Descriptions for SiteMap generation</description>
      </configuration>
    </execution>
  </exectuions>
</plugin>

So when I run mvn release:prepare it wants to resolve snapshot dependencies and then it errors with:

[INFO] An error has occurred in SiteMapDoclet report generation: Unable to find artifact:groupId = 'us.ak.state.revenue.cssd' 
[INFO] artifactId = 'doc' 
[INFO] version = '1.5.8' 
[INFO]  
[INFO] Unable to download the artifact from any repository

So how do I correctly reference my Doclet when I deploy my project?

Was it helpful?

Solution

@khmabaise is correct to reference my old Question: How can I compile and run my Custom Doclet class in my project?

Turns out the solution while slightly messy was to move doc to docletPath

<docletPath>
  \;.;${project.build.outputDirectory};
  ${project.parent.basedir}/doc/target/doc-${project.version}.jar;
  ${m2Repository}/us/ak/state/revenue/cssd/doc/${project.version}/doc-${project.version}.jar;
</docletPath>

and then in the add doc's dependencies directly to <docletArtifact>

for the record ${m2Repository} is defined in my my poms properties as

<m2Repository>${env.USERPROFILE}/.m2/repository</m2Repository>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top