今天把單點登陸的core模塊搬到了github倉庫 並且利用github倉庫作為maven倉庫 在項目中進行了引用
1. 起初看技術博客沒有完全引入進來,調整了一下OK了
2. 還可以將其他模塊或者工具類,常用的類,自己用的類發布到GitHub倉庫 作為maven依賴
maven部署的插件,部署本地:
<!--github上傳插件,用於修改后的發布,執行mvn clean deploy自動打包上傳到github--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> <configuration> <altDeploymentRepository>internal.repo::default::file://${repository.directory}/web-sso-core</altDeploymentRepository> </configuration> </plugin>
使用mvn clean deploy命令部署
部署到遠端github倉庫的插件:
<plugin> <groupId>com.github.github</groupId> <artifactId>site-maven-plugin</artifactId> <version>0.12</version> <configuration> <message>Maven artifacts for ${project.artifactId}-${project.version}</message> <noJekyll>true</noJekyll> <outputDirectory>${repository.directory}/web-sso-core</outputDirectory> <branch>refs/heads/master</branch> <merge>true</merge> <includes> <include>**/*</include> </includes> <repositoryName>web-sso-core</repositoryName> <repositoryOwner>deadzq</repositoryOwner> </configuration> <executions> <execution> <goals> <goal>site</goal> </goals> <phase>deploy</phase> </execution> </executions> </plugin>
同樣是使用mvn clean deploy.
配置文件,repository.directory是項目的根路徑,在另一個地方指定模塊的文件夾名: 如上面的插件的web-sso-core
<properties> <java.version>1.8</java.version> <jedis.version>3.0.0</jedis.version> <github.global.server>github</github.global.server> <repository.directory>C:\Users\ukyo\Documents\</repository.directory> </properties>
需要開放本地maven倉庫的,設定用戶名密碼:
settings.xml:
server標簽:
<server> <id>github</id> <username>yourgithubloginname</username> <password>yourpassword</password> </server>
注意整個配置中的id應該相同.
另一邊,在項目中去使用時,需要配置github倉庫: 二級標簽 (一級標簽project)
<repositories> <repository> <id>github</id> <url>https://raw.github.com/deadzq/web-sso-core/master</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories>
其中里面的url獲取方式為,找到你發布好的github的模塊,前面加二級域名raw. 后面加 /master ,假如你是發布到master分支的話.
最后加入這個模塊即可:
<dependency> <groupId>com.sso</groupId> <artifactId>web-sso-core</artifactId> <version>1.0.0</version> </dependency>
正常引入:

其他資料:
