发布到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
执行命令进行打包:
好像可以不用打包
在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>
|