Mavenの学習(7):使用してMavenのPW

、MavenのPW構造

1、ネクサス倉庫タイプ

1.1、ホストされた(ホストされているリポジトリ)

内部のリリースバージョン倉庫、内部テストバージョンのスナップショット会社の倉庫をリリースし、リリースおよび二つの部分のスナップショットを含め、倉庫のこのタイプに独自のjarファイルを展開します。

1.2、プロキシ(プロキシ倉庫)

そのような中央リポジトリ達人などの公共機関のためのリモートリポジトリは、ユーザがPW、PWが自動的に中央倉庫ジャーパッケージまたはプラグにダウンロード接続します。

1.3グループ(倉庫群)

複数のホスト型/プロキシ倉庫を結合するために、我々は通常、その接続のMaven倉庫グループを設定します。

1.4、仮想(バーチャル)

ジャーまたはプラグインのMaven1互換バージョン。

2、ネクサス倉庫

  • 中央:演技の倉庫、中央ウェアハウス・エージェント
  • pache-スナップショット:エージェントの倉庫、店舗のスナップショットメンバー、プロキシアドレスhttps://repository.apache.org/snapshots/
  • 中央M1:仮想倉庫タイプ、ジャーの互換性のあるバージョンまたはプラグMaven1
  • リリース:ローカルリポジトリ、記憶手段リリース。
  • スナップショット:ローカルリポジトリ、メモリのスナップショットメンバー。
  • サードパーティ:サードパーティの倉庫
  • 公共:倉庫グループ

PW使用Mavenの二、

1、PWにプロジェクトを公開します

1.1、PWを接続するためのMavenのconfigureユーザーとパスワードで設定ファイルのsettings.xml

1.2、プロジェクトのためのpom.xmlファイルで構成アドレスPW倉庫

    <!--配置私服仓库的地址-->
    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://localhost:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

PWから2.ダウンロードしたjarパッケージ

2.1、ネクサスオープン構成リポジトリー基として次の

2.2、設定ファイルsettings.xml内のMavenリポジトリ設定

	<profiles>
		<!-- 下载jar包配置 -->
		<profile>
			<!--profile的id -->
			<id>dev</id>
			<repositories>
				<repository> <!--仓库id,repositories可以配置多个仓库,保证id不重复 -->
					<id>nexus</id> <!--仓库地址,即nexus仓库组的地址 -->
					<url>http://localhost:8081/nexus/content/groups/public/</url> <!--是否下载releases构件 -->
					<releases>
						<enabled>true</enabled>
					</releases> <!--是否下载snapshots构件 -->
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories> <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
				<pluginRepository> <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
					<id>public</id>
					<name>Public Repositories</name>
					<url>http://localhost:8081/nexus/content/groups/public/</url>
				</pluginRepository>
			</pluginRepositories>
		</profile>
		<profile>    
			<id>jdk-1.8</id>    
			<activation>    
				<activeByDefault>true</activeByDefault>    
				<jdk>1.8</jdk>    
			</activation>    
			<properties>    
				<maven.compiler.source>1.8</maven.compiler.source>    
				<maven.compiler.target>1.8</maven.compiler.target>    
				<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>    
			</properties>     
		</profile>
	</profiles>

 2.3、力にそれを持って、プロファイル定義ウェアハウスを使用して活性化しました。

<!--激活使用profile定义的仓库-->
<activeProfiles>
	<activeProfile>dev</activeProfile>
</activeProfiles>

3、PWへのサードパーティのjarパッケージ

1、設定ファイルのsettings.xml Mavenの第三者倉庫のサーバー構成情報

<!--配置第三方仓库的server信息-->
<server>
	<id>thirdparty</id>
	<username>admin</username>
	<password>admin123</password>
</server>

2、サードパーティ製のjarコマンドPWへのインストールパッケージ

mvn deploy:deploy-file -DgroupId=项目的名称 -DartifactId=jar包名称 -Dversion=jar包版本 -Dpackaging=jar -Dfile=jar包所在目录及jar包文件名 -Durl=私服下载地址 -DrepositoryId=thirdparty

如:
mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37 -Dpackaging=jar -Dfile=H:\Technology\Java\repository\fastjson-1.1.37.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

 

发布了134 篇原创文章 · 获赞 10 · 访问量 7336

おすすめ

転載: blog.csdn.net/yu1755128147/article/details/104034734