Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 创造不同的",;“分配”;项目的_Java_Maven_Maven Assembly Plugin - Fatal编程技术网

Java 创造不同的",;“分配”;项目的

Java 创造不同的",;“分配”;项目的,java,maven,maven-assembly-plugin,Java,Maven,Maven Assembly Plugin,我正在从Ant转换(或至少尝试)到Maven。 我正在构建一个复杂的项目,生成一个WAR文件,扩展到一个文件夹中 然后,在Ant中,我创建了10个不同的“发行版”,这意味着我将一些属性文件、CSS和HTML文件从“config/”目录复制到文件夹中,创建一个,并对下一个“config/”文件夹重复该步骤 最后,我为每个客户定制了10个ZIP文件和资源 and代码看起来是这样的(可能不是最好的ant代码,但工作得很完美): 我怎么能对maven做这样的事? 我应该使用个人资料吗? 我应该用ma

我正在从Ant转换(或至少尝试)到Maven。 我正在构建一个复杂的项目,生成一个WAR文件,扩展到一个文件夹中

然后,在Ant中,我创建了10个不同的“发行版”,这意味着我将一些属性文件、CSS和HTML文件从“config/”目录复制到文件夹中,创建一个,并对下一个“config/”文件夹重复该步骤

最后,我为每个客户定制了10个ZIP文件和资源

and代码看起来是这样的(可能不是最好的ant代码,但工作得很完美):


我怎么能对maven做这样的事? 我应该使用个人资料吗? 我应该用maven来完成这个任务吗

欢迎任何帮助

谢谢,, schube

您需要使用以下示例:

父pom,用于将所有子项目放在一起:

<?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.greg</groupId>
  <artifactId>war-overlay-example</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <modules>
    <module>base-war</module>
    <module>dist1-war</module>
  </modules>

</project>

4.0.0
com.greg

不清楚您到底想从我们这里得到什么,因为我们肯定不会将您的整个Ant文件移植到Maven。但是是的,使用个人资料似乎是一种方式。“我是否应该使用maven来完成这项任务?”这是基于观点的。你当然可以。嗨,迈克尔!我想要什么?一个指向正确方向的指针,我不希望任何人移植我的ant文件:-)问题是,我读到它说,一个人不应该使用配置文件。另一方面,我认为我的“定制发行版”用例不是一个例外,应该/必须有一个推荐的maven方式,我正在寻找它。因此,我只需要一个“按外形方式”或“不使用它,按XY方式使用此用例”。非常感谢。我推荐看看谢谢!我想这就是我需要的!我一定会尽快尝试!非常感谢github的例子!比我要求的还要多!
<?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.greg</groupId>
  <artifactId>war-overlay-example</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <modules>
    <module>base-war</module>
    <module>dist1-war</module>
  </modules>

</project>
<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.greg</groupId>
        <artifactId>war-overlay-example</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>base-war</artifactId>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>base-war</finalName>
    </build>

</project>
<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.greg</groupId>
        <artifactId>war-overlay-example</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>dist1-war</artifactId>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>com.greg</groupId>
            <artifactId>base-war</artifactId>
            <version>${project.version}</version>
            <type>war</type>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>dist1-war</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <overlays>
                        <overlay>
                            <groupId>com.greg</groupId>
                            <artifactId>base-war</artifactId>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>