Hello! 
 
I'm trying to modify the behaviour of a build so that during development
those parts of the target that do not change between builds do not get
wiped out and re-extracted every time as these activities take up most
of the build time. For instance, as part of the build we extract the
java installation inside the target. Currently the maven-clean plugin,
by default, wipes clean the target so this extraction has to happen
every time.  I have come up  with configuration changes that allow
selective deletion of directories within the target and modified the
build. However, I still need to do a complete wipe out and build on
occasion so I need a way to change the clean behavior. My initial
thought was to use a profile so that the command line for a selective
clean and build would be:
 
mvn clean install
 
And for my total rebuild it would be 
 
mvn  -P cleanall clean install
 
I use ( well, try to use) a profile to wipe out all the target then the
selective clean would not really do anything and the build would proceed
as normal only this time the rules, for instance , to  extract the java
would now activate.   The problem is this does not work. The profile
does not activate. Nor do I see how to ensure that it activates before
the build. ( I do not put the build inside of a profile since the
development team is used to 'mvn clean install'. I do not want to have
them specify an additional parameter.) . My pom is organized as below.
In my tests, I have put the profile first (does order in file make a
difference?) but it did not work.  I've put the entire build inside the
cleanall profile but the standard build runs anyway.  Why is this not
working? Surely at the very least I should get both the default build to
run then the profile clean to run or visa versa.  Am I on the right
track or is there a better way 
to get the behavior I want?  
 
<b<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  
  <parent>
   ... stuff here...
  </parent>
 
  <properties>
   ... stuff here ...
  </properties>
<!-- build not in a profile so by default it runs -->
  <build>
    <plugins>
    <!-- selective Clean -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.4</version>
        <configuration>
   <excludeDefaultDirectories>true</excludeDefaultDirectories>
          <filesets>
            <fileset>
       <directory>${cuts.dir}</directory>
            </fileset> 
     <fileset >
       <directory>${project.build.directory}</directory>
       <includes>
  <include>**/*</include>
       </includes> 
       <excludes>
  <exclude>follett/java/**/*</exclude>
  <exclude>follett/jboss/images/*</exclude>
  <exclude>follett/jboss/images-test/*</exclude>
       </excludes> 
       <followSymlinks>false</followSymlinks> 
     </fileset>
   </filesets>
        </configuration>
      </plugin>
      <!-- More plugins to complete build -->
    </plugins>
  </build>
 
<!--********************************************************************
************************************-->
  <!--Profile for building cleanall
-->
 
<!--********************************************************************
************************************-->
  <profiles>
    <profile>
      <id>cleanall</id>
      <build>
 <plugins>
   <plugin>
     <artifactId>maven-clean-plugin</artifactId>
     <version>2.4</version>
     <configuration>
     </configuration>
   </plugin>
 </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
        ... dependencies here ....
   </dependency>
  </dependencies>
</project>

Reply via email to