发布到GitHub
修改setting.xml
修改maven的setting.xml文件,在servers节点下添加
<server>
<id>github</id>
<username>yourname</username>
<password>yourpassword</password>
</server>
使用maven插件
修改项目工程的pom.xml文件,添加以下两个插件:
maven-deploy-plugin
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<altDeploymentRepository>
internal.repo::default::file://${project.build.directory}/maven-repo
</altDeploymentRepository>
</configuration>
</plugin>
site-maven-plugin
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<message>🐳 deploy maven artifacts, version: ${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${project.build.directory}/maven-repo</outputDirectory>
<branch>refs/heads/master</branch>
<merge>true</merge>
<includes>
<include>**/*</include>
</includes>
<repositoryName>maven-repo</repositoryName>
<repositoryOwner>cayzlh</repositoryOwner>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
###deploy
执行命令进行打包:
mvn clean package
好像可以不用打包
在idea左侧lifecycle中双击deploy:

静静等待…..

使用
在需要使用到私服的项目pom.xml文件中添加:
<repositories>
<repository>
<id>maven-repo</id>
<url>https://raw.githubusercontent.com/yourname/maven-repo/master/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>


















