Dan*_*lan 5 maven-plugin maven
我正在使用名为maven-enunciate-plugin的插件生成 rest api 的(非 javadoc)文档。现在我想将它上传到我的 javadoc 存储库。为此,我正在使用wagon-maven-plugin。
问题是,我不知道如何告诉 wagon 插件使用该站点的 settings.xml 中的用户名/密码。如果您使用maven-site-plugin,它似乎知道如何通过定义distributionManagement标签来做到这一点,但我没有使用 maven-site-plugin 插件,因为我生成的文档没有它。
这是我的 pom 来显示我尝试过的内容:
<profile>
<id>generate-rest-doc</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.27</version>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
<configuration>
<docsDir>${project.build.directory}/docs</docsDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-4</version>
<executions>
<execution>
<id>upload-javadoc</id>
<phase>package</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<fromDir>${project.build.directory}/docs</fromDir>
<includes>*</includes>
<url>scp://MY-REPO/var/www/html/projects/rest-war</url>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<site>
<id>javadoc</id>
<url>scp://MY-REPO/var/www/html/projects/-rest-war</url>
</site>
</distributionManagement>
</profile>
....
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
</build>
Run Code Online (Sandbox Code Playgroud)
我想出了一个解决方法。我没有直接使用 wagon-maven-plugin,而是使用 maven-site-plugin。我明确使用部署目标来指向 maven-enunciate-plugin 生成的目录。
所以上面我注释掉了 wagon 插件并在 enunciate 插件下面添加了这个:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>upload-javadoc</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<inputDirectory>${project.build.directory}/docs</inputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3847 次 |
| 最近记录: |