DhanaGitHub / maven-replacer-plugin

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

replacer add /null at basedir and cannot search file #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I find file not found error and the basedir config being added /null at the end,
Can I know what's wrong with the plugins config?

What steps will reproduce the problem?
1. I try to do some replacement for testing on apache's commons-collections4 
src code

2. I have to add following plugins in my pom.xml

<plugin>
    <groupId>com.google.code.maven-replacer-plugin</groupId>
    <artifactId>replacer</artifactId>
    <version>1.5.2</version>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>replace</goal>
            </goals>
            <configuration>
                <ignoreMissingFile>true</ignoreMissingFile>
                <includes>
                    <include>src/main/java/*.java</include>
                </includes>
                <excludes>
                    <exclude>src/main/java/*.xml</exclude>
                    <exclude>src/main/java/*.txt</exclude>
                </excludes>
                <replacements>
                    <replacement>
                        <token>java.util</token>
                        <value>java.myutil</value>
                    </replacement>
                    <replacement>
                        <token>org.apache.commons.collections4</token>
                        <value>org.apache.commons.collections5</value>
                    </replacement>
                </replacements>
            </configuration>
        </execution>
    </executions>
</plugin>

3. I run the mvn as following

$ ~/apache-maven-3.0.5/bin/mvn 
com.google.code.maven-replacer-plugin:maven-replacer-plugin:replace -X

4. I got error as following

[DEBUG] Configuring mojo 
'com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.4.1:replace' 
with basic configurator -->
[DEBUG]   (s) basedir = /home/user1/workspace2/commons-collections4
[DEBUG] -- end configuration --
[ERROR] File '/home/user1/workspace2/commons-collections4/null' does not exist
[INFO] Replacement run on 0 file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.969s
[INFO] Finished at: Sat Dec 14 13:46:22 EST 2013
[INFO] Final Memory: 5M/72M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.4.1:replace 
(default-cli) on project commons-collections4: File 
'/home/user1/workspace2/commons-collections4/null' does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.4.1:replace 
(default-cli) on project commons-collections4: File 
'/home/user1/workspace2/commons-collections4/null' does not exist
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: File 
'/home/user1/workspace2/commons-collections4/null' does not exist
    at com.google.code.maven_replacer_plugin.ReplacerMojo.execute(ReplacerMojo.java:359)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.io.FileNotFoundException: File 
'/home/user1/workspace2/commons-collections4/null' does not exist
    at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:265)
    at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1457)
    at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1475)
    at com.google.code.maven_replacer_plugin.file.FileUtils.readFile(FileUtils.java:35)
    at com.google.code.maven_replacer_plugin.ReplacementProcessor.replace(ReplacementProcessor.java:21)
    at com.google.code.maven_replacer_plugin.ReplacerMojo.replaceContents(ReplacerMojo.java:404)
    at com.google.code.maven_replacer_plugin.ReplacerMojo.execute(ReplacerMojo.java:349)
    ... 21 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Original issue reported on code.google.com by ttuun...@gmail.com on 14 Dec 2013 at 4:41

GoogleCodeExporter commented 9 years ago
I'm observing the same behavior, any updates on this?
Thanks!

Original comment by lenk...@googlemail.com on 6 Feb 2014 at 9:22

GoogleCodeExporter commented 9 years ago
Found a solution to my problem. Looks like as soon as you move the 
configuration to the execution block, you cannot call it via replacer:replace 
anymore but only via the phase.

Original comment by lenk...@googlemail.com on 9 Feb 2014 at 3:45

GoogleCodeExporter commented 9 years ago
Are you sure you're running 1.5.2? Your logs suggest that it's 1.4.1.

Original comment by baker.st...@gmail.com on 19 Feb 2014 at 1:14

GoogleCodeExporter commented 9 years ago
Closing. Issue appears to be resolved.

Original comment by baker.st...@gmail.com on 16 Apr 2014 at 9:24