非MVNプロジェクトとMVN MVN PWにプロジェクトをビルドします
一.背景
同社のシステムは、今あなたが古いプロジェクトのMVNプロジェクトと非プロジェクトを有効にする必要があり、MVNを使用する必要があるもある悪いMVNのビルドと拡大一切使用MVNがない、古いシステムであるが、今継続的インテグレーション(CI)を使用する準備ができています。
独自のMVN PWを構築し、いくつかのプロジェクトは、中央リポジトリジャーにあるので、ダウンロードすることができませんので、私は会社のサーバー上で、独自のプライベートサーバ・ウェアハウスを構築するために、プライベートサーバー上でこれらのjarを広めるために必要があります。
II。非ターンMVNプロジェクトMVNプロジェクト
もちろん、最も直感的な違い1.非MVNとMVNプロジェクトのpom.xml、今、私たちは自分自身のプロジェクトのPOMファイルを作成する必要があります。
2.私は、ツールのアイデアを使用しています、私はちょうど右ポンポンファイル、ものの残りの部分にMVNプロジェクトを追加するには、事のツールです。
3.今、あなたは内部に書かれたポンポンファイル内のすべての以前のプロジェクトをjarファイルする必要があり、水があるのは、最初のjarはとにかく、見つける、または問題のバージョンを頼らないかもしれないものがたくさん続く、より多くので、かなり深いですこれには少し時間がかかります。
あなたは見つけることができませんどのように中央リポジトリに包まれた部分MVNジャーを見つけた場合、あなたはこのjarパッケージがあったことがないかもしれないことを実現したい場合がありますので、私たちは、独自のjarファイルをアップロードするためにPWを使用する必要があります。
III。PWのインストール
1.ダウンロードネクサスの無料版:https://www.sonatype.com/download-oss-sonatype:
プロジェクトの選択、そのニーズバージョン2またはバージョン3によると、ダウンロードが成功した後、自分自身をインストールします。インストールが成功した後、ページ上の以下の情報を見ることができます起動します。
最初のログインアカウント/パスワード:管理者/ admin123、ポート8080、すべての設定変更自身で設定することができ、言っても過言ではありません。
IV。設定項目
1.ローカルリポジトリのMVNを変更してのsettings.xmlをMVN
内部のsettings.xmlファイル内のインストールパスの設定が変更され、MVNを使用するプラグインをインストールして下さい:
<servers> <!-- server | Specifies the authentication information to use when connecting to a particular server, identified by | a unique name within the system (referred to by the 'id' attribute below). | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | <server> <id>deploymentRepo</id> <username>repouser</username> <password>repopwd</password> </server> --> <server> <id>central</id> <username>admin</username> <password>admin123</password> </server> <server> <id>thirdparty</id> <username>admin</username> <password>admin123</password> </server> <!-- Another sample, using keys to authenticate. <server> <id>siteServer</id> <privateKey>/path/to/private/key</privateKey> <passphrase>optional; leave empty if not used.</passphrase> </server> --> </servers>
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <id>nexus-releases</id> <url>http://192.168.50.191:8081/nexus/content/groups/public/</url> <mirrorOf>*</mirrorOf> </mirror> <mirror> <id>nexus-snapshots</id> <url>http://192.168.50.191:8081/nexus/content/groups/public//</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors>
在pom文件里面添加:
<repositories> <repository> <id>central</id> <name>Central</name> <url>http://192.168.50.191:8081/nexus/content/repositories/central/</url> </repository> <repository> <id>thirdparty</id> <name>3rd party</name> <url>http://192.168.50.191:8081/nexus/content/repositories/thirdparty/</url> </repository> </repositories>
五.上传jar包到mvn私服
这里面有2种方式(命令和页面操作)
1.页面操作
这个就不用多说了,就是界面点点点
2.命令上传
在你的项目pom文件目录,cmd执行上传:
mvn deploy:deploy-file -DgroupId=com.fh -DartifactId=servlet-api -Dversion=1.0 -Dpackaging=jar -Dfile=E:\workspace\BPM\WebRoot\WEB-INF\lib\servlet-api.jar -Durl=http://192.168.50.191:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty
mvn私服是公司里面必备的技能之一,可以多多学习下。