You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mraible <ma...@raibledesigns.com> on 2007/02/03 19:52:11 UTC
Is it possible to do string replacement in an archetype?
I'd have the following in the pom.xml of an archetype:
<jdbc.url><![CDATA[jdbc:mysql://localhost/${artifactId}?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>
If users use a dash in their artifactId, this will fail on most databases.
Is there a String replacement tool available in the VelocityContext of the
archetype-plugin? I'd like to do something like:
$stringutil.replace(${artifactId}, '-', '_')
Thanks,
Matt
--
View this message in context: http://www.nabble.com/Is-it-possible-to-do-string-replacement-in-an-archetype--tf3167058s177.html#a8785517
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: Is it possible to do string replacement in an archetype?
Posted by mraible <ma...@raibledesigns.com>.
I tried this and it doesn't work. If I pass in an archetypeId with a dash in
it, it gets replaced verbatime with the archetypeId (no replacement takes
place).
Matt
Raphaël Piéroni-3 wrote:
>
> Hi Matt,
>
> According to String javadoc, you could try the replace(char oldChar, char
> newChar) method
>
> <jdbc.url><![CDATA[jdbc:mysql://localhost/${artifactId.replace('-','_')}
> ?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>
>
> I don't know if it works.
>
> Regards,
>
>
> Raphaël
>
>
> 2007/2/3, mraible <ma...@raibledesigns.com>:
>>
>> I'd have the following in the pom.xml of an archetype:
>>
>> <jdbc.url
>><![CDATA[jdbc:mysql://localhost/${artifactId}?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>
>>
>> If users use a dash in their artifactId, this will fail on most
>> databases.
>> Is there a String replacement tool available in the VelocityContext of
>> the
>> archetype-plugin? I'd like to do something like:
>>
>> $stringutil.replace(${artifactId}, '-', '_')
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
> http://www.nabble.com/Is-it-possible-to-do-string-replacement-in-an-archetype--tf3167058s177.html#a8785517
>> 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
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Is-it-possible-to-do-string-replacement-in-an-archetype--tf3167058s177.html#a8785763
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: Is it possible to do string replacement in an archetype?
Posted by Raphaël Piéroni <ra...@gmail.com>.
Hi Matt,
According to String javadoc, you could try the replace(char oldChar, char
newChar) method
<jdbc.url><![CDATA[jdbc:mysql://localhost/${artifactId.replace('-','_')}
?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>
I don't know if it works.
Regards,
Raphaël
2007/2/3, mraible <ma...@raibledesigns.com>:
>
> I'd have the following in the pom.xml of an archetype:
>
> <jdbc.url
><![CDATA[jdbc:mysql://localhost/${artifactId}?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>
>
> If users use a dash in their artifactId, this will fail on most databases.
> Is there a String replacement tool available in the VelocityContext of the
> archetype-plugin? I'd like to do something like:
>
> $stringutil.replace(${artifactId}, '-', '_')
>
> Thanks,
>
> Matt
> --
> View this message in context:
http://www.nabble.com/Is-it-possible-to-do-string-replacement-in-an-archetype--tf3167058s177.html#a8785517
> 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
>
>