11

tomcat zipアーティファクトをダウンロードして、tomcatという名前のフォルダーに解凍しようとしています。私が得るものはtomcat/apache-tomcat-7.0.19 /です。迷惑な中間ディレクトリを取り除くにはどうすればよいですか?

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
    <execution>
        <id>unpack-tomcat</id>
        <phase>process-sources</phase>
        <goals>
            <goal>unpack</goal>
        </goals>
        <configuration>
            <artifactItems>
                <artifactItem>
                    <groupId>org.apache</groupId>
                    <artifactId>tomcat</artifactId>
                    <version>7.0.19-win64</version>
                    <type>zip</type>
                    <overWrite>false</overWrite>
                    <outputDirectory>tomcat</outputDirectory>
                    <excludes>webapps/**</excludes>
                </artifactItem>
            </artifactItems>                            
        </configuration>
    </execution>
</executions>
</plugin>
4

3 に答える 3

6

たぶん、私の提案を達成するためのより「マベニッシュな」方法があるかもしれません:)しかし、maven antプラグインを使用すると、状況の回避策になる可能性があります:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <target>
                                <move file   = "tomcat/apache-tomcat-7.0.19/*"
                                      tofile = "tomcat" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <target>
                                <delete dir = "tomcat/apache-tomcat-7.0.19"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
</plugin>
于 2013-03-11T23:53:53.103 に答える
-2

unpack-depencenciesゴールを使用し、useSubDirectoryPerArtifact を false に設定します。

于 2012-01-19T18:05:02.090 に答える