在构建Maven项目项目结构的特定模块时,我遇到了如下问题:
数据输入者(母公司A)
|____弹簧批(子B,jar)
|____码头(儿童C)
我正在使用IntelliJ (但尝试使用CLI和相同的行为)来构建,当我从父pom构建时没有问题,但是当我试图先构建spring批处理,然后构建docker时,我有当前的错误:
Could not find artifact ***.****.****.****:data-importer:pom:develop in nexus (http://**********/repository/maven-dev-group/)我不知道它为什么要得到父母的pom,即使我在“孩子的爸爸”中定义了relativePath
我有以下POM (不包括机密部分):
数据导入器(父A)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>*******</groupId>
<artifactId>data-importer</artifactId>
<version>develop</version>
<packaging>pom</packaging>
<name>data-importer</name>
<description>data importer application for *</description>
<parent>
<groupId>*****.*****.******</groupId>
<artifactId>super-pom</artifactId>
<version>2.2.1-SNAPSHOT</version>
<relativePath/>
</parent>
<properties>
some versions
</properties>
<modules>
<module>spring-batch</module>
<module>docker</module>
</modules>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>*.*.*.*</groupId>
<artifactId>data-importer-spring-batch</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>**春季-批(A儿童)**
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>****.****.**.***</groupId>
<artifactId>data-importer</artifactId>
<version>develop</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>data-importer-spring-batch</artifactId>
<version>develop</version>
<packaging>jar</packaging>
<name>spring-batch</name>
<description>data importer application for *</description>
<dependencies>
some dependencies
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<executions>
<execution>
<id>data-importer</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
one dependency
</dependencies>
</dependencyManagement>
</project>码头(儿童C)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>*.*.*.*</groupId>
<artifactId>data-importer</artifactId>
<version>develop</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>scpas-import</artifactId>
<version>develop</version>
<packaging>pom</packaging>
<name>docker</name>
<description>data importer application for docker</description>
<profiles>
<!-- Profil commun pour générer les images docker -->
<profile>
<id>docker</id>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!--Copy du jar spring batch dans target/docker/volumes/transferdata/import/data-importer -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-data-importer-jar-files</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<includeGroupIds>*.*.*.*</includeGroupIds>
<includeArtifactIds>data-importer-spring-batch</includeArtifactIds>
<type>jar</type>
<outputDirectory>
${project.build.directory}/docker/volumes/transferdata/import/data-importer/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/docker</outputDirectory>
<resources>
<resource>
<directory>${basedir}/database</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/data-importer</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<filtering>true</filtering>
<includes>
<include>Dockerfile</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<filtering>true</filtering>
<includes>
<include>docker-compose.data-importer.yml</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<filtering>true</filtering>
<includes>
<include>docker-entry-point.sh</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!--Génération de image docker-->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<dockerDirectory>${project.build.directory}/docker</dockerDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>
docker-push
</id>
some steps to push image in our registry
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>*.*.*.*</groupId>
<artifactId>data-importer-spring-batch</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>知道它为什么要从注册表中获取家长POM吗?(我不想把它作为mvn依赖项来推动)
Thx
我在settings.xml中尝试了一些技巧,不从注册表中提取快照和发行版,但是除了从父的POM构建完整的项目之外,什么都不起作用
发布于 2022-11-25 10:45:50
由于提供了对父-POM的访问,所以您可以在本地安装它。
这将解决查找存储库的父库问题。
您需要的是使用-N (非递归)选项mvn install -N调用Maven,然后您应该能够使用它。
https://stackoverflow.com/questions/74571066
复制相似问题