[ 
http://jira.codehaus.org/browse/MSANDBOX-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=163557#action_163557
 ] 

Rasto Cesnek commented on MSANDBOX-44:
--------------------------------------

Adding a code snipplet:

try {
    File.update();
} catch (ArchiveException e) {
    throw new MojoExecutionException( "Update() failed.",  e );
}

to the end of the execute() of the copy, move and delete MOJOs solves the 
problem. The install phase then works with a correctly upated archive. The only 
drawback is that if there are more executions, the update happens after each 
execution, i.e. the entire files is flushed after each execution.

Another possiblity I used was to create a simple update MOJO, which does 
nothing else in execute but the above code snipplet. I added this execution as 
the last one in the list of executions. This also solves the problem, the 
drawback is that one has to think about it and remember that he may need to 
flush the changes performed by truezip plugin before proceeding with the build.

Is there some clever possiblity in Maven how to implement this clean-up task at 
the appropriate moments i.e. so that when the processing of goals for a given 
phase finishes, the manipulated archives are updated?

> maven-truezip-plugin: after processing with truezip in package phs., 
> out-of-date resource is installed into repo in install phs.
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MSANDBOX-44
>                 URL: http://jira.codehaus.org/browse/MSANDBOX-44
>             Project: Maven 2.x Sandbox
>          Issue Type: Bug
>         Environment: Windows XP, Maven 2.0.9, maven-truezip 
> 1.0-beta-1-SNAPSHOT
>            Reporter: Rasto Cesnek
>
> In the <build> section, I use truzip plugin bound to package phase to 
> manipulate a large archive (a 12M SAR file) to remove unwanted stuff from the 
> packaging (remove **/META-INF/maven/ directories from dependent JARs, etc.). 
> When I ran "mvn clean install", the plugin scans the SAR file during the 
> package phase. Then the install phase follows. When the build finishes, the 
> SAR file in the /target folder is correct - all META-INF/maven directories 
> removed. How ever, the file which is installed during the install phase IS 
> NOT CORRECT, it still contains all the META-INF/maven directories in it. When 
> observing the behavior closely, it looks like the file manipulated by truezip 
> is NOT YET UPDATED on the file system, when the install phase runs. It seems, 
> that it gets updated after the install pahse finishes - shortly before the 
> entire maven build finishes.
> The expected behavior would be, that the file processed by truezip lands in 
> the repo after install.
> Is this connected to OS (Windows XP) and some file cacheing? May it have 
> something to do with the file size? A threading problem?
> <plugin>
>       <groupId>org.codehaus.mojo</groupId>
>       <artifactId>truezip-maven-plugin</artifactId>
>       <version>1.0-beta-1-SNAPSHOT</version>
>       <executions>
>               <execution>
>                       <!-- Remove META-INF/maven s from embedded archives,
>                       JBoss 3.2.8 has digestive problems with them and then 
> pukes incomplete deployment messages. -->
>                       <id>remove maven metas from jars</id>
>                       <goals>
>                               <goal>remove</goal>
>                       </goals>
>                       <phase>package</phase>
>                       <configuration>
>                               <fileset>
>                                       
> <directory>${project.build.directory}/${project.build.finalName}.sar/</directory>
>                                       <includes>
>                                               
> <include>**/META-INF/maven/</include>
>                                       </includes>
>                               </fileset>
>                               <verbose>true</verbose>
>                       </configuration>
>               </execution>
>       </executions>
> </plugin>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to