我在我的maven项目(ide eclipse)上定义了两个配置文件(Prod和CI),当我启动install命令时,它会创建一个包含jar文件和项目属性的字段。如果我先启动prod,然后再启动CI,则它将创建两个不同的字段,并且可以。但是,如果我与“ install prod,ci”一起引导,它将仅创建ci字段,并进行属性合并。有什么方法可以一起启动属性,并确保它创建两个字段,例如分别启动时?谢谢。
我向您展示poms(CI的配置与PROD相同) pom1(Maven收集器项目)
<!-- PROD ENVIRONMENT -->
<profile>
<id>profile-release</id>
<build>
<plugins>
<!-- Merge all properties into one -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<property name="maven.project.basedir"
value="${project.basedir}" />
<property name="maven.project.parent.build.directory"
value="${project.parent.build.directory}" />
<concat
destfile="${maven.project.parent.build.directory}/job.properties">
<fileset dir="${maven.project.basedir}/../"
includes="**/target/classes/META-INF/spring/batch/props/c-job-t*.properties"></fileset>
</concat>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Copy all dependencies not included into CBS -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.4</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
<destFileName>gson-2.8.4.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>PROFILE</name>
<value>profile-release</value>
</property>
</activation>
</profile>
pom2 (main pom)
<profile>
<id>profile-release</id>
<build>
<plugins>
<!-- Copy all generate jars and dependencies not included into CBS -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
<overWrite>true</overWrite>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
<destFileName>${project.build.finalName}.${project.packaging}</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>PROFILE</name>
<value>profile-release</value>
</property>
</activation>
<properties>
<project.type.environment>commonPROD</project.type.environment>
<project.parent.build.directory>${project.basedir}/../c-batch-job-t/target/profile-ce</project.parent.build.directory>
</properties>
</profile>