英文:
Add dependency management pom from private repo
问题
以下是您要翻译的内容:
我在一个需要大量库或模块的项目上工作。所有依赖项都存储在我的私有Maven仓库中(使用AWS S3)。我设置了一切,项目正常运行。
	<distributionManagement>
		<snapshotRepository>
			<id>maven-repo.notelis.com</id>
			<url>s3://maven-repo.notelis.com/snapshot</url>
		</snapshotRepository>
		<repository>
			<id>maven-repo.notelis.com</id>
			<url>s3://maven-repo.notelis.com/release</url>
		</repository>
	</distributionManagement>
这是分发管理。我在构建部分中使用了正确的传输器:
<extensions>
			<extension>
				<groupId>com.github.noyessie.plugin</groupId>
				<artifactId>aws-maven</artifactId>
				<version>7.0.0</version>
			</extension>
		</extensions>
为了集中管理依赖项版本,我决定使用Maven BOM。为此,我遵循了Maven文档,一切在本地都正常工作(本地我使用了 mvn install )。为了使其对其他项目可用。
<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>com.neyos.saas</groupId>
				<artifactId>notelis-dependencies</artifactId>
				<version>${notelis.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
问题出现在我尝试在CI中构建项目时。我收到以下错误消息:
[ERROR]     Non-resolvable import POM: Could not find artifact com.neyos.saas:notelis-dependencies:pom:0.0.1-SNAPSHOT @ line 120, column 16 -> [Help 2]
似乎Maven只检查中央仓库中dependencyManagement部分的依赖项,而不是在我的私有仓库中。有没有办法让Maven从我的私有仓库中获取dependencyManagement部分中存在的依赖项,而不是从中央仓库获取?
PS:我不想使用中央仓库。
英文:
I work on a project that need a big number of library or module. All dependencies are stored in my private maven repository ( using AWS S3 ). I setup everything and the project work well.
	<distributionManagement>
		<snapshotRepository>
			<id>maven-repo.notelis.com</id>
			<url>s3://maven-repo.notelis.com/snapshot</url>
		</snapshotRepository>
		<repository>
			<id>maven-repo.notelis.com</id>
			<url>s3://maven-repo.notelis.com/release</url>
		</repository>
	</distributionManagement>
That is the distribution management. I used the correct transporter in build section:
<extensions>
			<extension>
				<groupId>com.github.noyessie.plugin</groupId>
				<artifactId>aws-maven</artifactId>
				<version>7.0.0</version>
			</extension>
		</extensions>
To centralize the dependencies version management, I decided to use maven BOM. for that, I follow the maven documentation and everything work well locally ( locally i used mvn install ). to make it available for the other project.
<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>com.neyos.saas</groupId>
				<artifactId>notelis-dependencies</artifactId>
				<version>${notelis.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
The problems begins when i try to build a project in my CI. I got the error :
[ERROR]     Non-resolvable import POM: Could not find artifact com.neyos.saas:notelis-dependencies:pom:0.0.1-SNAPSHOT @ line 120, column 16 -> [Help 2]
It seems like maven only check the dependencies of section dependencyManagement in central repository, not in my private repository. So the is a way to ask to maven to fetch the dependency present in section dependencyManagement in my private repository. Not on central repository ?
PS: I don't want to use central repository.
答案1
得分: -1
为了让Maven在某个存储库中搜索依赖项,您必须在POM文件的存储库部分列出该存储库。
英文:
For maven to search dependencies in some repository you must enlist that repository in repositories section of pom-file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论