如何使用docletArtifact作为自引用依赖项部署Multi Module Maven项目?

时间:2013-10-15 00:16:36

标签: java maven doclet

我有一个像这样的多模块Web应用程序项目:

家长

  1. 网络基地
  2. AUTH
  3. 文档
  4. ADFS
  5. 测试现场
  6. Test-Site 使用所有其他模块就好了。

    doc 结合JavaDocs和挂载的网页信息来构建SiteMap。因为它正在为我的SiteMap生成解析JavaDocs 它也是一个Doclet Jar,因为Doclet是解析和存储站点地图信息的最简单方法。

    测试站点 pom.xml中我有

    <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>
    

    因此,当我运行mvn release:prepare时,它想要解决快照依赖关系,然后错误:

    [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
    

    那么在部署项目时如何正确引用我的Doclet?

1 个答案:

答案 0 :(得分:0)

@khmabaise引用我的旧问题是正确的:How can I compile and run my Custom Doclet class in my project?

原来解决方案虽然稍微混乱,但是将 doc 移动到 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>

然后将 doc 的依赖项直接添加到<docletArtifact>

记录${m2Repository}

在我的poms属性中定义为

<m2Repository>${env.USERPROFILE}/.m2/repository</m2Repository>