同事们,早上好。 我有一个多模块Maven项目,如下所示:
bigdata
core
pom
operations
pom
runner
pom
pom(main)
我有本地和Hadoop环境。我需要部署两个版本,一个用于hadoop,一个用于本地。我想使用Maven分类器。我尝试使用maven-jar-plugin。它有效,但是我得到了三个jar文件。例如:
core-1.0.4-local-58kb 核心1.0.4群集-64kb 核心-1.0.4 -27MB
对于其他包装来说,情况相同。 我使用gitlab ci部署到工件。这是来自ci.yaml:
script:
# Run the MVN command
- ./jfrog rt mvn "versions:set -DgenerateBackupPoms=false -Dartifactory.publish.artifacts=false -DnewVersion="${CI_COMMIT_TITLE}" -Phadoop" configuration.yml --build-name=multirating-bigdata --build-number=$CI_JOB_ID
- ./jfrog rt mvn "clean install -Phadoop" configuration.yml --build-name=multirating-bigdata --build-number=$CI_JOB_ID
# Collect the environment variables
- ./jfrog rt bce multirating-bigdata $CI_JOB_ID
# Pass the build information to Artifactory
- ./jfrog rt bp multirating-bigdata $CI_JOB_ID
我在这里使用类似How to manage artifactory / maven artifact using different profiles的内容:
<profiles>
<profile>
<id>profile1</id>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>jdk6</classifier>
</configuration>
</execution>
</executions>
<plugin>
<plugins>
</build>
</profile>
<profile>
<id>profile2</id>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>jdk7</classifier>
</configuration>
</execution>
</executions>
<plugin>
<plugins>
</build>
</profile>
</profiles>
我的问题是:
我不明白为什么前两个罐子都这么重? 是否存在添加分类器的最简单方法?