Closed blutorange closed 5 years ago
Comment by tekhedd Wednesday Apr 12, 2017 at 19:05 GMT
FYI workaround: add this so that it will run before the minify plugin. (Note use of deprecated tasks element!) [updated to fix failure to build after clean]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>minify-map-file-workaround</id>
<!-- phase/goal must match minify-maven-plugin -->
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete>
<!-- Delete all map files found in the output dir. Output dir should exist by
- this time in the build process even if it's a clean build. map file might not.
-->
<fileset dir="${project.build.directory}">
<!-- Caveat: if this is not the path to your map file, no error will occur. -->
<include name="${project.build.finalName}/*.map" />
</fileset>
</delete>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Should be fixed via merging https://github.com/samaxes/minify-maven-plugin/pull/149
Issue by tekhedd Wednesday Apr 12, 2017 at 18:44 GMT Originally opened as https://github.com/samaxes/minify-maven-plugin/issues/142
Using minify-maven-plugin 1.7.6.
When rebuilding a project using closureCreateSourceMap, the sourceMappingUrl is correctly generated on a clean build, but not inserted into the minified file on a rebuild.
My tests indicate that the //#sourceMappingUrl will be generated only if the original .js.map file does not exist. In other words, if I run
mvn clean ; mvn package
sourceMappingUrl is present. If I run 'mvn package' again without cleaning, sourceMappingUrl is missing.
If I manually remove target/exploded-dir/merged.min.js.map and then run 'mvn package' again, the sourceMappingUrl is generated.
The timestamp on the .map file is not changed, so it appears that closure is failing to regenerate it, hence the missing sourceMappingUrl line.
Workaround? Explicitly delete the source map file as part of the build, or always explicitly clean the target before deploying. (The target always runs regardless of whether it needs to be rebuilt, so in netbeans "clean and build" followed by "run" results in no map file.)
Note: all mvn runs performed with "-e" "-DskipTests" for this experiment. Hope this helps.
File names have been changed to protect the innocent.