You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christian Schuhegger <Ch...@gmx.de> on 2011/06/23 20:40:16 UTC

Question about maven archetype: how to convert ${artifactId} into a file system path?

Hello list,

I am writing a maven archetype and it would be useful to convert an 
${artifactId} (e.g. my.nice.little.project) into a path: 
my/nice/little/project.

If this is possible, could somebody please point me to the relevant 
documentation? I did not find it via google.

Many thanks,
-- 
Christian Schuhegger
http://www.el-chef.de/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question about maven archetype: how to convert ${artifactId} into a file system path?

Posted by Christian Schuhegger <Ch...@gmx.de>.
Thanks for your response. Actually your answer is another piece of 
information that I was looking for, but not the answer to my original 
question.

I want to write a script, e.g. a shell script "work.sh". In this script 
I need to reference a file in src/main/java/${package}/${artifactId}. 
Now in for example ${package} I have a name separated with dots, e.g. 
my.nice.little.project, but I need to convert the dots into file system 
separators so that the final result looks like
src/main/java/${package}/${artifactId}.java
->
src/main/java/my/nice/little/project/project-name.java

How can I convert inside of the template the ${package} element from a 
dot separated item into a file system separator separated item?

Thanks,


Anders Hammar wrote:
> Name the folder "__artifactId__" and it will be expanded when using the
> archetype.
>
> /Anders
>
> On Thu, Jun 23, 2011 at 20:40, Christian Schuhegger<
> Christian.Schuhegger@gmx.de>  wrote:
>
>> Hello list,
>>
>> I am writing a maven archetype and it would be useful to convert an
>> ${artifactId} (e.g. my.nice.little.project) into a path:
>> my/nice/little/project.
>>
>> If this is possible, could somebody please point me to the relevant
>> documentation? I did not find it via google.
>>
>> Many thanks,
>> --
>> Christian Schuhegger
>> http://www.el-chef.de/
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>


-- 
Christian Schuhegger
http://www.el-chef.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question about maven archetype: how to convert ${artifactId} into a file system path?

Posted by Christian Schuhegger <Ch...@gmx.de>.
Sorry for my stupid question. After your answer my question became more 
clear to me and I found the answer in the Velocity documentation:

http://dotcms.com/docs/1.9/VelocityStringReplaceRegex

Only one question remains: is there a predefined variable in the 
velocity context that would tell me what the file system separator on 
the given operating system is?

Thanks,
-- 
Christian Schuhegger
http://www.el-chef.de/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question about maven archetype: how to convert ${artifactId} into a file system path?

Posted by Christian Schuhegger <Ch...@gmx.de>.
Thanks for your response. Actually your answer is another piece of 
information that I was looking for, but not the answer to my original 
question.

I want to write a script, e.g. a shell script "work.sh". In this script 
I need to reference a file in src/main/java/${package}/${artifactId}. 
Now in for example ${package} I have a name separated with dots, e.g. 
my.nice.little.project, but I need to convert the dots into file system 
separators so that the final result looks like
src/main/java/${package}/${artifactId}.java
->
src/main/java/my/nice/little/project/project-name.java

How can I convert inside of the template the ${package} element from a 
dot separated item into a file system separator separated item?

Thanks,


Anders Hammar wrote:
> Name the folder "__artifactId__" and it will be expanded when using the
> archetype.
>
> /Anders
>
> On Thu, Jun 23, 2011 at 20:40, Christian Schuhegger<
> Christian.Schuhegger@gmx.de>  wrote:
>
>> Hello list,
>>
>> I am writing a maven archetype and it would be useful to convert an
>> ${artifactId} (e.g. my.nice.little.project) into a path:
>> my/nice/little/project.
>>
>> If this is possible, could somebody please point me to the relevant
>> documentation? I did not find it via google.
>>
>> Many thanks,
>> --
>> Christian Schuhegger
>> http://www.el-chef.de/
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>


-- 
Christian Schuhegger
http://www.el-chef.de/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question about maven archetype: how to convert ${artifactId} into a file system path?

Posted by Anders Hammar <an...@hammar.net>.
Name the folder "__artifactId__" and it will be expanded when using the
archetype.

/Anders

On Thu, Jun 23, 2011 at 20:40, Christian Schuhegger <
Christian.Schuhegger@gmx.de> wrote:

> Hello list,
>
> I am writing a maven archetype and it would be useful to convert an
> ${artifactId} (e.g. my.nice.little.project) into a path:
> my/nice/little/project.
>
> If this is possible, could somebody please point me to the relevant
> documentation? I did not find it via google.
>
> Many thanks,
> --
> Christian Schuhegger
> http://www.el-chef.de/
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>