将文件夹创建到maven包中

create folder into maven package

我想将“”中包含的所有文件夹包含在将在名为 "common" 的包中创建的文件夹中。

更明确地说,我希望树结构采用这种形式:

mypackage.jar
    | common
        | library
        | public
        | layout
        | application
        | rss
        | config
        | package.properties
        | .htaccess

目前它有效,但交付物具有以下形式:

mypackage.jar
    | library
    | public
    | layout
    | application
    | rss
    | config
    | package.properties
    | .htaccess

这个操作我想不通了,貌似很简单。抱歉,第一次做maven脚本

非常感谢您的宝贵时间:)

这是我的代码:

    <build>
        <directory>target</directory>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <outputDirectory>${project.build.directory}/pdc</outputDirectory>
        <resources>
            <resource>
            <directory>${project.basedir}</directory>
                <includes>
                    <include>library/</include>
                    <include>public/</include>
                    <include>layout/</include>
                    <include>application/</include>
                    <include>rss/</include>
                    <include>config/include.php</include>
                    <include>config/constant.php</include>
                    <include>.htaccess</include>
                    <include>package.properties</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <outputDirectory>target</outputDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

添加targetPath如下。

<project>
   <build>
       ...
      <resources>
         <resource>
             <targetPath>common</targetPath>
               ...
          </resource>
      </resources>

      <testResources>
           ...
      </testResources>
      ...
  </build>
</project>