Letractively / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

groupNameMappingFile doesn't support filepaths that don't yet exist #800

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Include a groupNameMappingFile element in the maven plugin config, with a 
path to a file that is in a folder structure that doesn't yet exist. (i.e. 
target/classes, not just target).
2. Execute the plugin using the "run" goal.

What is the expected output? What do you see instead?
I would expect the folder path to be created if it doesn't yet exist (this is 
useful in cases where you want to write out your groupNameMappingFile 
properties as a generated resource to the target folder (or even in 
target/classes).  Instead, the operation fails because the folder doesn't yet 
exist.

What version of the product are you using? On what operating system?
Version 1.7.1 of the Maven plugin on Maven 3.0.4, using Java 7 on Windows 7.

Please provide any additional information below.

A recommended simple fix is within the writeGroupNameMap() method.  Before 
building the output stream (final FileOutputStream outputStream = new 
FileOutputStream(groupNameMappingFile);), do something like this:

  File mappingFile = new File(groupNameMappingFile);
  mappingFile.mkdirs();

To make the directory path to the file first.  Then, instantiate the 
outputStream with the File object instead:

  final FileOutputStream outputStream = new FileOutputStream(mappingFile);

Original issue reported on code.google.com by spart...@gmail.com on 14 Oct 2013 at 6:33

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 14 Oct 2013 at 6:43

GoogleCodeExporter commented 9 years ago
Fixed in branch 1.7.x

Original comment by alex.obj...@gmail.com on 20 Oct 2013 at 8:35