Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.tmp files packed with minified versions to WAR #32

Closed
dms-it opened this issue Aug 5, 2013 · 4 comments
Closed

.tmp files packed with minified versions to WAR #32

dms-it opened this issue Aug 5, 2013 · 4 comments
Assignees
Labels
Milestone

Comments

@dms-it
Copy link
Contributor

dms-it commented Aug 5, 2013

A merged .tmp files are being brought to WAR after minifying.

For example my configuration as follows:

<execution>
    <id>client-js-minify</id>
    <phase>process-resources</phase>
    <configuration>
        <charset>utf-8</charset>
        <jsEngine>yui</jsEngine>
        <jsSourceDir>static/js</jsSourceDir>
        <jsSourceFiles>
            <jsSourceFile>modules/commons/Console.js</jsSourceFile>
...
            <jsSourceFile>client.js</jsSourceFile>
        </jsSourceFiles>
        <nosuffix>true</nosuffix>   
        <jsFinalFile>client-min.js</jsFinalFile>
    </configuration>
    <goals>
        <goal>minify</goal>
    </goals>
</execution>

in this case client-min.js.tmp was packed to WAR file thogether with clinet-min.js

Maven: Eclipse Build in Maven 3.0.4/1.4.0.20130531-2315

@samaxes
Copy link
Owner

samaxes commented Aug 5, 2013

Can you please share a project where that issue can be observed?
I'm being unable to reproduce it.

@dms-it
Copy link
Contributor Author

dms-it commented Aug 6, 2013

Well, sorry I cant do that because it is internal proprietary project. But I have found the source of the problem. Were I more familiar with git I would fix it by myself. But at this point I have to ask you to do it if you don`t mind.

 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/samaxes/maven/minify/plugin/ProcessFilesTask.java b/src/main/java/com/samaxes/maven/minify/plugin/ProcessFilesTask.java
index 734ebfd..39ce453 100644
--- a/src/main/java/com/samaxes/maven/minify/plugin/ProcessFilesTask.java
+++ b/src/main/java/com/samaxes/maven/minify/plugin/ProcessFilesTask.java
@@ -161,7 +161,9 @@ public abstract class ProcessFilesTask implements Callable<Object> {
                             : FileUtils.basename(mergedFilename) + suffix + FileUtils.getExtension(mergedFilename));
                     minify(mergedFile, minifiedFile);
                     if (nosuffix) {
-                        mergedFile.deleteOnExit();
+                       if (!mergedFile.delete()) {
+                           mergedFile.deleteOnExit();
+                       }
                     }
                 }
                 log.info("");

@dms-it
Copy link
Contributor Author

dms-it commented Aug 16, 2013

I have prepared eclipse project which reproduces the bug. Please, take a look:
https://dl.dropboxusercontent.com/u/17107691/github_shares/samaxes/minify-maven-plugin/32/testapp_bug_repro.7z

Notice, that final war (/testapp/target/testapp.war) contains excessive temporal file: static\js\client-min.js.tmp

@samaxes
Copy link
Owner

samaxes commented Aug 25, 2013

I merged your code into the master branch. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants