迭代pom文件中的@item@

qaxu7uf2  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(255)

我是maven方面的Maven,我正在从事一个项目,其体系结构是:InputProjectArchi
在我想要的构建之后:在构建之后输出
因此,对于每个环境,我希望有一个jar,其中包含这个环境的类和属性文件(例如:propfile_dev.properties only in the jar of the dev environment)。
我在下面编写了pom.xml文件,但没有给出预期的结果。你能帮助我吗?

<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>Test</groupId>
    <artifactId>Test</artifactId>
    <version>1.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <spark.version>2.1.0</spark.version>
        <java.version>1.8</java.version>
        <version.scala>2.11.7</version.scala>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.15.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <!--<version>2.2-beta-5</version>!-->
            </plugin>

            <plugin>
                <groupId>com.soebes.maven.plugins</groupId>
                <artifactId>iterator-maven-plugin</artifactId>
                <version>0.5.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>iterator</goal>
                        </goals>
                        <configuration>
                            <items>
                                <item>dev</item>
                                <item>int</item>
                                <item>prod</item>
                            </items>

                            <pluginExecutors>
                                <pluginExecutor>
                                    <plugin>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-assembly-plugin</artifactId>
                                        <!--<version>2.4</version>!-->
                                        <configuration>
                                            <archive>
                                                <manifest>
                                                    <mainClass>com.domain.prjname.Test</mainClass>
                                                </manifest>
                                            </archive>
                                            <descriptorRefs>
                                                <descriptorRef>jar-with-dependencies</descriptorRef>
                                            </descriptorRefs>
                                        </configuration>
                                    </plugin>
                                    <goal>single</goal>
                                    <configuration>
                                        <descriptors>
                                            <descriptor>${project.basedir}/@item@.xml</descriptor>
                                        </descriptors>
                                    </configuration>
                                </pluginExecutor>
                            </pluginExecutors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>org.apache.spark</id>
            <url>https://repo1.maven.apache.org/maven2/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.11.8</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>````

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题