[英]How can I tell wagon-maven-plugin to use a username and password from my settings.xml?
I'm generating the (non javadoc) documentation of a rest api using a plugin named maven-enunciate-plugin . 我正在使用名为maven-enunciate-plugin的插件生成rest api的(非javadoc)文档。 Now I want to upload it to my javadoc repository.
现在我想将它上传到我的javadoc存储库。 I'm using the wagon-maven-plugin for this.
我正在使用wagon-maven-plugin 。
The problem is, I can't figure out how to tell the wagon plugin to use the username/password in the settings.xml for this site. 问题是,我无法弄清楚如何告诉wagon插件在本网站的settings.xml中使用用户名/密码。 If you use the maven-site-plugin , it seems to know how to do this by defining a
distributionManagement
tag, but I'm not using a maven-site-plugin plugin because I'm generating the documentation without it. 如果您使用maven-site-plugin ,它似乎知道如何通过定义
distributionManagement
标记来实现这一点,但我没有使用maven-site-plugin插件,因为我在没有它的情况下生成文档。
Here's my pom to show what I've tried: 这是我的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>
Came across this blog post while searching for a solution to this very problem: http://blog.darrenscott.com/2010/08/05/uploading-files-using-scp-and-the-maven-wagon-plugin/ Essentially you need to use a serverId
property in the configuration
. 在搜索这个问题的解决方案时遇到了这篇博文: http : //blog.darrenscott.com/2010/08/05/uploading-files-using-scp-and-the-maven-wagon-plugin/您需要在
configuration
使用serverId
属性。 Hope this helps someone. 希望这有助于某人。
I figured out a workaround. 我想出了一个解决方法。 Instead of using wagon-maven-plugin directly, I use the maven-site-plugin.
我没有直接使用wagon-maven-plugin,而是使用maven-site-plugin。 I explicitly use the deploy goal to point to the directory that maven-enunciate-plugin generated.
我明确使用部署目标指向maven-enunciate-plugin生成的目录。
So above I commented out the wagon plugin and added this below the 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.