jmporterog / maven-replacer-plugin

Automatically exported from code.google.com/p/maven-replacer-plugin
MIT License
0 stars 0 forks source link

Absolute filenames on windows throw Error: Error creating directory #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Define a replacer mojo with "outputFile" parameter.
2.  Use ${project.build.directory} in parameter value.
3.  Run your build on windows.

What is the expected output? What do you see instead?

A successful build.  Instead I get an error.  This seems to be because the 
OutputFilenameBuilder attempts to append an absolute windows path to the 
current windows directory.

What version of the product are you using? On what operating system?

This is with version 1.3.7 on Windows.

Please provide any additional information below.

I am attaching a patch.  It does two things: 

1. Doesn't throw an Error anymore - throws an IllegalStateException instead.  
This allows maven to fail properly and provide proper feedback to the user.

2. Uses a File object and the "isAbsolute" method to check if a path is 
absolute, rather than startsWith("/").

Original issue reported on code.google.com by jared.bunting@peachjean.com on 10 May 2011 at 9:39

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch. I'll look into applying it and releasing the fix ASAP.
-- Steven

Original comment by baker.st...@gmail.com on 10 May 2011 at 10:45

GoogleCodeExporter commented 9 years ago
Patch has been applied and will be in the next release.

Original comment by baker.st...@gmail.com on 12 May 2011 at 3:14

GoogleCodeExporter commented 9 years ago
Is there a timeframe on that?

Original comment by jared.bunting@peachjean.com on 12 May 2011 at 3:43

GoogleCodeExporter commented 9 years ago
Probably tonight after I finish work. I will run a release and publish to 
central repo. However, it can take a few hours to migrate through sonatype's 
central repo.

Original comment by baker.st...@gmail.com on 12 May 2011 at 3:46

GoogleCodeExporter commented 9 years ago
OSS Sonatype are having downtime whilst they move their servers (again). There 
might be some delay before I can release tonight, it may end having to be 
tomorrow morning.

Original comment by baker.st...@gmail.com on 12 May 2011 at 10:37

GoogleCodeExporter commented 9 years ago
Not a problem - I can use my patched version for a couple of weeks at least.  
Just wanted to make sure we weren't talking "indefinite" - then I'd have had to 
come up with another plan.

Original comment by jared.bunting@peachjean.com on 12 May 2011 at 2:12

GoogleCodeExporter commented 9 years ago
OSS Sonatype finally back up and just released  1.3.8. In the past it has taken 
about 3 hours to reach public central.

Enjoy :-)

Original comment by baker.st...@gmail.com on 12 May 2011 at 9:30

GoogleCodeExporter commented 9 years ago
1.3.8 now deployed to maven central repo. Please test and let me know how it 
goes.

Original comment by baker.st...@gmail.com on 13 May 2011 at 1:20

GoogleCodeExporter commented 9 years ago
Will do - I'll update our build tonight and get our one windows guy to try
and run it in the morning.

Thanks!

Comment #8 on issue 51 by baker.st...@gmail.com: Absolute filenames on
windows throw Error: Error creating directory

http://code.google.com/p/maven-replacer-plugin/issues/detail?id=51
1.3.8 now deployed to maven central repo. Please test and let me know how it
goes.

Original comment by jared.bunting@peachjean.com on 13 May 2011 at 1:25

GoogleCodeExporter commented 9 years ago
For me it's still not working even if I have 1.3.8 installed:

[DEBUG] Configuring mojo 'com.google.code.maven-replacer-plugin:maven-replacer-p
lugin:1.3.8:replace' -->
[DEBUG]   (s) basedir = D:\sobczyk\Desktop\old_pkdb
[DEBUG]   (s) file = D:\sobczyk\Desktop\old_pkdb\target/pkdbWebTool-0.1.14.BUILD
-SNAPSHOT/applicationScaffold/applicationScaffold.nocache.js
...
org.apache.maven.lifecycle.LifecycleExecutionException: File 'D:\sobczyk\Desktop
\old_pkdb\D:\sobczyk\Desktop\old_pkdb\target\pkdbWebTool-0.1.14.BUILD-SNAPSHOT\a
pplicationScaffold\applicationScaffold.nocache.js' does not exist

And this is relevant fragment of plugin configuration:
<file>${project.build.directory}/${project.build.finalName}/applicationScaffold/
applicationScaffold.nocache.js</file>

Didn't you hardcoded C:\ to detect the absolute path in Windows?

Original comment by sobczyk.peter@gmail.com on 5 Oct 2011 at 7:07

GoogleCodeExporter commented 9 years ago
Hi Peter,

I did not set anywhere to use c:\ by hardcoding.

Try adding <basedir></basedir> (empty basedir) to your maven-replacer-plugin 
configuration.

This may be because the root dir is not be being detected depending on where 
mvn is being run from. With this configuration, absolute paths should be used 
when the basedir being empty.

Let me know how you go,

Kind regards,
Steven

Original comment by baker.st...@gmail.com on 5 Oct 2011 at 11:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for fast feedback, Steven.

Despite I followed your advice and my maven-replacer-plugin config looks like 
that right now: 

...
<basedir></basedir>                 <file>${project.build.directory}/${project.build.finalNa
me}/applicationScaffold/applicationScaffold.nocache.js</file>
...

Nothing really changed. I'm still getting:

[DEBUG]   (s) basedir = D:\sobczyk\Desktop\old_pkdb
[DEBUG]   (s) file = D:\sobczyk\Desktop\old_pkdb\target/pkdbWebTool-0.1.14-LTE/a
pplicationScaffold/applicationScaffold.nocache.js
...
org.apache.maven.lifecycle.LifecycleExecutionException: File 'D:\sobczyk\Desktop
\old_pkdb\D:\sobczyk\Desktop\old_pkdb\target\pkdbWebTool-0.1.14-LTE\applicationS
caffold\applicationScaffold.nocache.js' does not exist

So it seems that adding <basedir></basedir> has no effect at all.

Original comment by sobczyk.peter@gmail.com on 6 Oct 2011 at 7:41