Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. Now I want to upload it to my javadoc repository. I'm using the wagon-maven-plugin for this.

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

Here's my pom to show what I've tried:

<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>
like image 782
Daniel Kaplan Avatar asked Aug 07 '13 19:08

Daniel Kaplan


1 Answers

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. Hope this helps someone.

like image 88
Matthew Wise Avatar answered Oct 13 '22 08:10

Matthew Wise