我希望我的Maven项目文档(网站)部署在我网站的docs文件夹中。
我现在正在使用Apache Maven Wagon SSH来完成工作。 SSH连接工作得很好,它将一个zip文件推送到主机并解压缩它。
我在这些例子中使用假名; provider.com
,company.com
和company
但解压缩放在错误的文件夹中......
相反,它穿过了dirs;/domains/company.com/htdocs/docs/
并创建这些文件夹以将文档放入:/${project.slug}/${project.artifactId}/${project.version}
它从根目录创建一个新目录:r.com/domains/company.com/htdocs/docs/${project.slug}/${project.artifactId}/${project.version}
如何管理SSH / SCP连接scp:ssh.provider.com
,而不是遍历/domains/company.com/htdocs/docs/
目录,最后使用里面的文档创建目录/${project.slug}/${project.artifactId}/${project.version}
?
: scp:ssh.provider.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/docs/ - Session: Opened
[INFO] Pushing C:\Users\nberl\Code\company\company-maven-parent\target\site
[INFO] >>> to scp:ssh.provider.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/./
Executing command: mkdir -p "r.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/./"
Executing command: mkdir -p "r.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/."
Executing command: scp -t "r.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/./wagon4192311672559342478.zip"
Uploading: ./wagon4192311672559342478.zip to scp:ssh.provider.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/
##########
Transfer finished. 40802 bytes copied in 0.064 seconds
Executing command: cd "r.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/./"; unzip -q -o "wagon4192311672559342478.zip"; rm -f "wagon4192311672559342478.zip"
Executing command: chmod -Rf g+w,a+rX r.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/
scp:ssh.provider.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/ - Session: Disconnecting
scp:ssh.provider.com/domains/company.com/htdocs/docs/company/company-parent/1-SNAPSHOT/ - Session: Disconnected
网站的分发管理:
<distributionManagement>
<site>
<id>company-docs</id>
<name>Company Docs</name>
<url>scp:ssh.provider.com/domains/company.com/htdocs/docs/${project.slug}/${project.artifactId}/${project.version}/docs</url>
</site>
</distributionManagement>
网站部署资料:
<profile>
<id>deploy-site</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>site-deploy</id>
<phase>site</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>