Maven. How to include specific folder or file when assemblying project depending on is it dev build or production?

Posted by user563588 on Stack Overflow See other posts from Stack Overflow or by user563588
Published on 2011-01-05T08:48:14Z Indexed on 2011/01/05 8:53 UTC
Read the original article Hit count: 204

Using maven-assembly-plugin

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
<configuration>
 <descriptors>
  <descriptor>descriptor.xml</descriptor>
 </descriptors>
 <finalName>xxx-impl-${pom.version}</finalName>
 <outputDirectory>target/assembly</outputDirectory>
 <workDirectory>target/assembly/work</workDirectory>
</configuration>

in descriptor.xml file we can specify

    <fileSets>
  <fileSet>
   <directory>src/install</directory>
   <outputDirectory>/</outputDirectory>
  </fileSet>
 </fileSets>

Is it possible to include specific file from this folder or sub-folder depending on profile? Or some other way...

Like this:

    <profiles>
  <profile>
   <id>dev</id>
   <activation>
    <activeByDefault>false</activeByDefault>
   </activation>
   <build>
    <resources>
     <resource>
      <directory>src/install/dev</directory>
      <includes>
       <include>**/*</include>
      </includes>
     </resource>
    </resources>
   </build>
  </profile>
  <profile>
   <id>prod</id>
   <build>
    <resources>
     <resource>
      <directory>src/install/prod</directory>
      <includes>
       <include>**/*</include>
      </includes>
     </resource>
    </resources>
   </build>
  </profile>
 </profiles>

But it puts resources in jar when packaging. But we need to put it in zip when assemblying as I already mentioned above :( Thanks!

© Stack Overflow or respective owner

Maven. How to include specific folder or file when assemblying project depending on is it dev build or production?

Posted by user563588 on Stack Overflow See other posts from Stack Overflow or by user563588
Published on 2011-01-05T09:12:21Z Indexed on 2011/01/05 9:54 UTC
Read the original article Hit count: 204

Using maven-assembly-plugin

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
<configuration>
 <descriptors>
  <descriptor>descriptor.xml</descriptor>
 </descriptors>
 <finalName>xxx-impl-${pom.version}</finalName>
 <outputDirectory>target/assembly</outputDirectory>
 <workDirectory>target/assembly/work</workDirectory>
</configuration>

in descriptor.xml file we can specify

    <fileSets>
    <fileSet>
        <directory>src/install</directory>
        <outputDirectory>/</outputDirectory>
    </fileSet>
</fileSets>

Is it possible to include specific file from this folder or sub-folder depending on profile? Or some other way...

Like this:

<profiles>
    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <build>
            <resources>
                <resource>
                    <directory>src/install/dev</directory>
                    <includes>
                        <include>**/*</include>
                    </includes>
                </resource>
            </resources>
        </build>
    </profile>
    <profile>
        <id>prod</id>
        <build>
            <resources>
                <resource>
                    <directory>src/install/prod</directory>
                    <includes>
                        <include>**/*</include>
                    </includes>
                </resource>
            </resources>
        </build>
    </profile>
</profiles>

But it puts resources in jar when packaging. But we need to put it in zip when assemblying as I already mentioned above :( Thanks!

© Stack Overflow or respective owner

Related posts about maven

Related posts about maven-assembly-plugin