DhanaGitHub / maven-replacer-plugin

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

Support multiple files, tokens and values #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Investigate supporting multiple replacements in multiple files with different 
tokens and values for each.

Original issue reported on code.google.com by baker.st...@gmail.com on 6 Oct 2009 at 10:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Possible pom configuration may be:
        <plugin>
            <groupId>bakersoftware</groupId>
            <artifactId>maven-replacer-plugin</artifactId>
            <version>x.x.x</version>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <configuration>
                    <files>
                        <file>
                            <name>target/someapp/jsp/header.jsp</file>
                            <regex>false</regex>
                            <token>$BUILD_NUMBER$</token>
                            <value>${buildNumber}</value>
                        </file>
                        <file>
                            <name>target/someapp/database.properties</file>
                            <token>database url</token>
                            <value>jdbc:postgresql:database</value>
                        </file>
                        ...
                    </files>
                    </configuration>
                </execution>
            </executions>
        </plugin>
However, the tag "files" may not be a good name.
If anyone sees any issues with this, please comment.

Original comment by baker.st...@gmail.com on 6 Oct 2009 at 11:07

GoogleCodeExporter commented 9 years ago
How about:

<configuration>
  <files path="target/generated-sources" includes="**/*.java">
    <token regexp="true">^(.+) class</token>
    <value>$1_foo class</value>
    <output-file>$path/$1_foo.java</output-file> (or some default pattern slicing the
input file into pieces.. maybe $path $file $ext etc..)
  </files>
</configuration>

Original comment by kut...@gmail.com on 13 Oct 2009 at 9:42

GoogleCodeExporter commented 9 years ago
I'm not sure you can specify attributes on elements in a maven plugin.
I'm having trouble digging up anything that might indicate you can do it all. 
:-(

Original comment by baker.st...@gmail.com on 14 Oct 2009 at 7:39

GoogleCodeExporter commented 9 years ago
You're right, I didn't think about maven not allowing for attributes on 
elements.
How about having <token>foo</token> and 
<regexp-token>[1-4].[4-1]</regexp-token>?
Something like this, maybe:

<configuration>
  <file>keep this as-is</file>
  <files>
    <path>target/generated-sources</path>
    <includes>**/*.java</includes> (many)
    <excludes>...</excludes> (many)
    <regex-token>^(.+) class</regex-token> or <token>...</token>
    <value>$1_foo class</value>
    <output-file>$path/$1_foo.java</output-file>
  </files>
</configuration>

And since this is multiple-file support, the <file> and <files> elements would 
be
cumulative? i.e. "File X" and "Files in target/foo" and "Files in target/bar 
that are
not *.xml" etc...

Original comment by kut...@gmail.com on 14 Oct 2009 at 3:35

GoogleCodeExporter commented 9 years ago
I don't think I can use "-" in element names, but I can simply use "_" or camel 
case.
Good suggestions on reducing parametres though, it looks good.

Thanks again :-)

Original comment by baker.st...@gmail.com on 16 Oct 2009 at 12:54

GoogleCodeExporter commented 9 years ago
This issue can be achieved by multiple execution blocks within your pom.xml (as 
long
as each block has a unique id).

However, I will keep this task open as this is perhaps not a clean solution.

Original comment by baker.st...@gmail.com on 12 Nov 2009 at 11:51

GoogleCodeExporter commented 9 years ago
Feature implemented in next release.

Original comment by baker.st...@gmail.com on 20 Dec 2009 at 11:09

GoogleCodeExporter commented 9 years ago

Original comment by baker.st...@gmail.com on 20 Dec 2009 at 11:17

GoogleCodeExporter commented 9 years ago
Just issue clean up.

Original comment by baker.st...@gmail.com on 17 Sep 2012 at 12:39