Я не уверен, как правильно работает POM в maven.Вот эта вещь.Мне удалось создать задание с помощью Jenkins, который собирает и публикует WAR из java-кода в Artifactory, используя maven (с подключаемым модулем artifactory) с номером задания в конце, чтобы сохранить управление версиями. Затем в artifactory создается maven-metadata.xml.как показано ниже.

После этого на втором задании, с опцией сборки с параметрами в jenkins, я выбираю артефакт и развертываю количество войн, которое я хочу, вот так

Теперь я хотел сделать то же самое, но используя maven, чтобы сжать только папку и опубликовать в артефакте.Я смог сделать это с помощью подключаемого модуля сборки maven, используя POM и файл zip.xml.Дело в том, что metadata.xml в артефакте не генерируется.Он генерирует только zip-файл (также jar-файл), но не metadata.xml, который необходим, чтобы я мог использовать jenkins для выбора Zip-файла.вот изображение из артефакта Zip и ошибка, которую я получаю от Дженкинса:


Итак, вопрос в том, как POM генерирует этот файл metadata.xml в артефакте?Я использовал тот же самый проект Java, который использовался для построения и публикации WAR, за исключением того, что в часть я включил плагин сборки maven в zip-файл, и zip был успешно загружен и создан, как я показал на изображении.Вот POM и zip.xml
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.grey</groupId>
<artifactId>go</artifactId>
<version>${releaseVersion}</version>
<name>go</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<releaseVersion>0.0.0-SNAPSHOT</releaseVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.20</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-documentdb</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>assembly/zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>single</goal> <!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
А вот zip.xml
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<baseDirectory>/</baseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>static</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Пожалуйста, нужна помощь, так как я имею дело с этим и не совсем понятно.Я не разработчик, поэтому мои знания в java и pom файлах и maven не одни из лучших.спасибо за вашу помощь!
Это jenkinfile для загрузки кода в артефакт.так же, как используется для приложения Java.Изменено только имя репо в артефакте и команда «пакет» вместо «чистая установка»
node {
def server = Artifactory.server 'azure-artifactory'
def rtMaven = Artifactory.newMavenBuild()
def buildInfo //= rtMaven.run pom: 'pom.xml', goals: 'clean install -D releaseVersion="${BUILD_NUMBER}"'
stage ('Code Checkout') {
git branch: 'devopstest',
credentialsId: '3e3c8889-0dcc-4b4d-bae1-ac140894d292',
url: 'ssh://git@bitbucket.org/xxxxx/xxxxxxx'
}
stage('Artifactory Configuration') {
// Tool name from Jenkins configuration
//rtMaven.tool = 'Apache Maven 3.0.5'
env.MAVEN_HOME = '/usr/share/maven/'
// Set Artifactory repositories for dependencies resolution and artifacts deployment.
rtMaven.deployer server: server, releaseRepo: 'go-fe-maven-2'
}
stage('Maven build') {
//buildInfo = rtMaven.run pom: 'pom.xml', goals: 'clean install -D releaseVersion="${BUILD_NUMBER}"'
buildInfo = rtMaven.run pom: 'pom.xml', goals: 'package -D releaseVersion="${BUILD_NUMBER}"'
// rtMaven.deployer.deployArtifacts buildInfo
}
stage('Publish build info') {
// server.publishBuildInfo buildInfo
server.publishBuildInfo buildInfo
}
// Wipe the workspace so we are building completely clean
deleteDir()
}