上海网站建设加q.479185700,访问网站速度慢,软件中心下载安装,未来3年房价走势预测如何通过maven将小型开源库提供给其他开发人员#xff1f; 一种方法是将其部署在Maven Central Repository上 。 我想要做的是将其部署到github #xff0c;因此我可以自由地对其进行修改。 这篇文章将告诉您如何做到这一点。 我将工件部署到github的典型方法是使用mvn depl… 如何通过maven将小型开源库提供给其他开发人员 一种方法是将其部署在Maven Central Repository上 。 我想要做的是将其部署到github 因此我可以自由地对其进行修改。 这篇文章将告诉您如何做到这一点。 我将工件部署到github的典型方法是使用mvn deploy 。 步骤如下 使用site-maven-plugin将工件推送到github 使用maven-javadoc-plugin推送Javadoc 使用maven-source-plugin推送源 配置Maven以将远程mvn-repo用作Maven存储库 配置Maven部署插件 首先我添加以下代码片段以告知Maven将工件部署到目标目录内的临时位置 distributionManagementrepositoryidinternal.repo/idnameTemporary Staging Repository/nameurlfile://${project.build.directory}/mvn-repo/url/repository
/distributionManagement
pluginspluginartifactIdmaven-deploy-plugin/artifactIdversion2.8.1/versionconfigurationaltDeploymentRepositoryinternal.repo::default::file://${project.build.directory}/mvn-repo/altDeploymentRepository/configuration/plugin
/plugins配置Maven 然后我将我的github.com身份验证信息添加到~/.m2/settings.xml以便github site-maven-plugin可以将其推送到github settingsserversserveridgithub/idpasswordOAUTH2TOKEN/password/server/servers
/settings 要么 settingsserversserveridgithub/idusernameGitHubLogin/usernamepasswordGitHubPassw0rd/password/server/servers
/settings 就我个人而言我更喜欢第一种方法因为它更安全无需明确显示密码。 要获取github项目的OAUTH2TOKEN 请转到settings -- Applications -- Genreate new token 配置site-maven-plugin 配置site-maven-plugin从我的临时位置上传到github上的mvn-repo分支 plugingroupIdcom.github.github/groupIdartifactIdsite-maven-plugin/artifactIdversion0.9/versionconfigurationmessageMaven artifacts for ${project.version}/messagenoJekylltrue/noJekylloutputDirectory${project.build.directory}/mvn-repo/outputDirectorybranchrefs/heads/mvn-repo/branchincludesinclude**/*/include/includesrepositoryNamepengyifan-commons/repositoryNamerepositoryOwneryfpeng/repositoryOwnerservergithub/server/configurationexecutionsexecutiongoalsgoalsite/goal/goalsphasedeploy/phase/execution/executions
/plugin 写这篇文章时存在0.9版site-maven-plugin 。 要解决此问题请git clone 0.10-SNAPSHOT版本并手动mvn install 。 配置maven-source-plugin 要将源代码包添加到mvn-repo中我们需要配置maven-source-plugin 。 在pom.xml添加以下代码 plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-source-plugin/artifactIdversion2.3/versionexecutionsexecutionidattach-sources/idgoalsgoaljar/goal/goals/execution/executions
/plugin配置Maven-javadoc-plugin 要将java doc软件包添加到mvn-repo中我们需要配置maven-javadoc-plugin 。 在pom.xml添加以下代码 plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-javadoc-plugin/artifactIdexecutionsexecutionidattach-javadocs/idgoalsgoaljar/goal/goals/execution/executions
/plugin 现在运行mvn clean deploy 。 我看到maven-deploy-plugin将文件“上传”到目标目录中的本地暂存库中然后site-maven-plugin提交这些文件并将其推送到服务器。 要验证所有二进制文件是否存在请在浏览器中访问github 然后选择mvn-repo分支。 配置Maven以将远程mvn-repo用作Maven存储库 我们应该采取的另一步骤是配置任何poms以知道我们的存储库在哪里。 我们可以将以下代码段添加到任何项目的pom.xml中 repositoriesrepositoryidPROJECT-NAME-mvn-repo/idurlhttps://raw.github.com/USERNAME/PROJECT-NAME/mvn-repo//urlsnapshotsenabledtrue/enabledupdatePolicyalways/updatePolicy/snapshots/repository
/repositories翻译自: https://www.javacodegeeks.com/2014/09/hosting-a-maven-repository-on-github-with-sources-and-javadoc.html