You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pankaj <pa...@rediffmail.com> on 2012/05/09 00:10:56 UTC
Maven replacer plugin
I want to replace the code snippet between two custom tag (@Start, @End) with
empty tag.
public class MyClass{
private String name;
private String age;
@Start
private String address;
private String phoneNumber;
@End
}
These tags are available in multiple files.
Is it possible using maven ? I was looking at
http://code.google.com/p/maven-replacer-plugin/
which is used for replacing text/value, i don't think this can be used for
replacing content. am i right ?
Regards
Pankaj
--
View this message in context: http://maven.40175.n5.nabble.com/Maven-replacer-plugin-tp5696070.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven replacer plugin
Posted by Pankaj <pa...@rediffmail.com>.
Thanks a lot Karl. I could get it working using replacer plugin with below
token
<configuration>
<file>xyz.java</file>
<token>@Start.*@End</token>
<value>-value-</value>
<regex>true</regex>
</configuration>
As you mentioned correctly, i'm stuck with copying file, it's ok for me to
copy under base directory, i tried using buildhelper-maven-plugin but
didn't work for me. Here is the plugin which i used
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}\publicSrc\mySrc</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Don't we have to tell maven about source path or does it take by default
from src/main/java ? In my case, publicSrc folder itself is not getting
created where as i'm expecting all of java file which is under src/main/java
to be under publicSrc/mySrc. Is there anything wrong with my configuration ?
Regards
Pankaj
--
View this message in context: http://maven.40175.n5.nabble.com/Maven-replacer-plugin-tp5696070p5698807.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven replacer plugin
Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,
> I want to replace the code snippet between two custom tag (@Start, @End) with
> empty tag.
>
> public class MyClass{
> private String name;
> private String age;
>
> @Start
> private String address;
> private String phoneNumber;
> @End
>
> }
> These tags are available in multiple files.
Why not. Put the replacer plugin into the generate-sources or
process-sources phase and it should be working. The only problem you
have to which location you put the changed files and get them compiled.
May be you can use the buildhelper-maven-plugin to add a different
location afterwards (for example target/replaced-files)
Kind regards
Karl-Heinz Marbaise
--
SoftwareEntwicklung Beratung Schulung Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl-Heinz Marbaise ICQ#: 135949029
Hauptstrasse 177 USt.IdNr: DE191347579
52146 Würselen http://www.soebes.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org