Arthur.D
Arthur.D

Reputation: 35

create folder into maven package

I would like to include all the folders contained in "" within a folder that will be created in the package that will be called "common".

To be more explicite, I would like the tree structure to be in this form:

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

For the moment it works however the deliverable has this form:

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

I can't figure out how to do this operation, which seems rather simple. Sorry, this is the first time I've done maven scripts.

Thank you very much for your time :)

Here is my code :

    <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>

Upvotes: 0

Views: 167

Answers (1)

Manish Bansal
Manish Bansal

Reputation: 2671

Add targetPath as below.

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

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

Upvotes: 1

Related Questions