使用maven'复制文件夹内容;解包依赖项

使用maven'复制文件夹内容;解包依赖项,maven,maven-plugin,Maven,Maven Plugin,我有一个在我的依赖项中定义的zip,如下所示 <dependency> <groupId>com.project.mine</groupId> <artifactId>${projectname}</artifactId> <version>${projectversion}</version> <classifier>bin</classifier>

我有一个在我的依赖项中定义的zip,如下所示

<dependency>
    <groupId>com.project.mine</groupId>
    <artifactId>${projectname}</artifactId>
    <version>${projectversion}</version>
    <classifier>bin</classifier>
    <type>zip</type>
</dependency>
<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>unpack-one</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
                <includeGroupIds>com.project.mine</includeGroupIds>
                <includeArtifactIds>projectone</includeArtifactIds>
                <type>zip</type>
                <outputDirectory>${target.assets}/www</outputDirectory>
            </configuration>
        </execution>
        <execution>
            <id>unpack-two</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
                <includeGroupIds>com.project.mine</includeGroupIds>
                <includeArtifactIds>${projectname}</includeArtifactIds>
                <type>zip</type>
                <outputDirectory>${target.assets}/www/ProjectOneContent</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

com.project.mine
${projectname}
${projectversion}
箱子
拉链
此zip包含两个文件夹,即

  • 文件夹1
  • 文件夹2
  • 我正在尝试复制此zip的内容,如下所示

    <dependency>
        <groupId>com.project.mine</groupId>
        <artifactId>${projectname}</artifactId>
        <version>${projectversion}</version>
        <classifier>bin</classifier>
        <type>zip</type>
    </dependency>
    
    <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <id>unpack-one</id>
                <phase>generate-resources</phase>
                <goals>
                    <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                    <includeGroupIds>com.project.mine</includeGroupIds>
                    <includeArtifactIds>projectone</includeArtifactIds>
                    <type>zip</type>
                    <outputDirectory>${target.assets}/www</outputDirectory>
                </configuration>
            </execution>
            <execution>
                <id>unpack-two</id>
                <phase>generate-resources</phase>
                <goals>
                    <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                    <includeGroupIds>com.project.mine</includeGroupIds>
                    <includeArtifactIds>${projectname}</includeArtifactIds>
                    <type>zip</type>
                    <outputDirectory>${target.assets}/www/ProjectOneContent</outputDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>
    
    
    maven依赖插件
    打开一个
    产生资源
    解包依赖项
    com.project.mine
    项目一
    拉链
    ${target.assets}/www
    打开两个包
    产生资源
    解包依赖项
    com.project.mine
    ${projectname}
    拉链
    ${target.assets}/www/ProjectOneContent
    
    我面临的问题是它复制了两个文件夹
    我只想将“Folder2”(可以是子文件夹、图像、js、css等)的内容复制到“ProjectOneContent”文件夹中


    注意:ProjectOneContent是在第一次执行完成后创建的。我可以看到,您没有定义任何
    包含
    模式(如上所述)。将以下内容添加到您的

    Folder2/**
    
    我是用 为了实现这一点,我首先在一个临时位置解包依赖项,然后在解包后,使用antrun在所需位置逐个复制每个资源