You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Karel Vervaeke <ka...@outerthought.org> on 2010/01/08 17:58:59 UTC

Resource filtering difficulties.

I'm having difficulties with resource filtering

In my pom I have:

          <resource>
            <targetPath>some path</targetPath>
            <filtering>true</filtering>
            <directory>${basedir}/src/main/xpatch</directory>
            <includes><include>*</include></includes>
          </resource>
....
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
              <escapeString>\</escapeString>
            </configuration>
          </plugin>

in src/main/xpatch I have:

<?xml version="1.0"?>
<patches xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  <patch xpath="/runtime/containers"
      remove="artifact[@id='competent']"/>
  <patch xpath="/runtime/containers"
      remove="artifact[@id='doctasks']"/>
  <patch xpath="/runtime/containers" insert-after="artifact[@id='workflow']">
    <artifact id="doctasks" groupId="daisy"
artifactId="daisy-doctaskrunner-server-impl" version="${myversion}"/>
    <artifact id="doctasks" groupId="daisy"
artifactId="daisy-doctaskrunner-server-impl" version="${myversion} "/>
    <artifact id="workflow" groupId="daisy"
artifactId="daisy-workflow-server-impl" version="${myversion}"/>
  </patch>
</patches>

In the output, ${myversion} is not replaced.
I have determined that the problem is caused by the fact that the @ is also a

I have also tried escaping the @ using the escape string defined in the pom,
but then the output looks like this::
  <patch xpath="/runtime/containers"
      remove="artifact[@id='competent']"/>

  <patch xpath="/runtime/containers"
      remove="artifact[\@id='doctasks']"/>

  <patch xpath="/runtime/containers" insert-after="artifact[\@id='workflow']">
...

(The first \@ is escaped, but for the others nothing happens.  IIUC
this has to do with the fact that the escape string is used to escape
pairs of at signs, but that seems like a strange way to handle
things).

I found some more info here:
http://maven.apache.org/shared/maven-filtering/, but nothing that
helped
In the end I ended up defining a property at=@ and using ${at} in my
resource, which works but isn't very nice.

Does anyone have ideas about this?
Regards,
Karel0

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


Re: Resource filtering difficulties.

Posted by Karel Vervaeke <ka...@outerthought.org>.
Your solution actually gave me a NullPointerException (in plexus-filtering),
because ${*} is replaced by "the value of property *" in the pom.

So you have to use
<delimiter>$${*}</delimiter> (It took me a while to figure out that
the ${ } is escaped by doubling the dollar sign :-))

Here's the jira issue I filed for improving the docs:
http://jira.codehaus.org/browse/MRESOURCES-115

Regards,
Karel

On Mon, Jan 11, 2010 at 9:08 AM, Karel Vervaeke <ka...@outerthought.org> wrote:
> Thanks!
>
> On Sat, Jan 9, 2010 at 5:36 PM, Olivier Lamy <ol...@apache.org> wrote:
>> Hi,
>> You can try with configuring the resources mojo as this :
>>
>> <useDefaultDelimiters>false</useDefaultDelimiters>
>> <delimiters>
>>  <delimiter>${*}</delimiter>
>> </delimiters>
>>
>> The @ won't be use as delimiter.
>>
>> --
>> Olivier
>>
>> 2010/1/8 Karel Vervaeke <ka...@outerthought.org>:
>>> I'm having difficulties with resource filtering
>>>
>>> In my pom I have:
>>>
>>>          <resource>
>>>            <targetPath>some path</targetPath>
>>>            <filtering>true</filtering>
>>>            <directory>${basedir}/src/main/xpatch</directory>
>>>            <includes><include>*</include></includes>
>>>          </resource>
>>> ....
>>>          <plugin>
>>>            <groupId>org.apache.maven.plugins</groupId>
>>>            <artifactId>maven-resources-plugin</artifactId>
>>>            <configuration>
>>>              <escapeString>\</escapeString>
>>>            </configuration>
>>>          </plugin>
>>>
>>> in src/main/xpatch I have:
>>>
>>> <?xml version="1.0"?>
>>> <patches xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>>>  <patch xpath="/runtime/containers"
>>>      remove="artifact[@id='competent']"/>
>>>  <patch xpath="/runtime/containers"
>>>      remove="artifact[@id='doctasks']"/>
>>>  <patch xpath="/runtime/containers" insert-after="artifact[@id='workflow']">
>>>    <artifact id="doctasks" groupId="daisy"
>>> artifactId="daisy-doctaskrunner-server-impl" version="${myversion}"/>
>>>    <artifact id="doctasks" groupId="daisy"
>>> artifactId="daisy-doctaskrunner-server-impl" version="${myversion} "/>
>>>    <artifact id="workflow" groupId="daisy"
>>> artifactId="daisy-workflow-server-impl" version="${myversion}"/>
>>>  </patch>
>>> </patches>
>>>
>>> In the output, ${myversion} is not replaced.
>>> I have determined that the problem is caused by the fact that the @ is also a
>>>
>>> I have also tried escaping the @ using the escape string defined in the pom,
>>> but then the output looks like this::
>>>  <patch xpath="/runtime/containers"
>>>      remove="artifact[@id='competent']"/>
>>>
>>>  <patch xpath="/runtime/containers"
>>>      remove="artifact[\@id='doctasks']"/>
>>>
>>>  <patch xpath="/runtime/containers" insert-after="artifact[\@id='workflow']">
>>> ...
>>>
>>> (The first \@ is escaped, but for the others nothing happens.  IIUC
>>> this has to do with the fact that the escape string is used to escape
>>> pairs of at signs, but that seems like a strange way to handle
>>> things).
>>>
>>> I found some more info here:
>>> http://maven.apache.org/shared/maven-filtering/, but nothing that
>>> helped
>>> In the end I ended up defining a property at=@ and using ${at} in my
>>> resource, which works but isn't very nice.
>>>
>>> Does anyone have ideas about this?
>>> Regards,
>>> Karel0
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Olivier
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: Resource filtering difficulties.

Posted by Karel Vervaeke <ka...@outerthought.org>.
Thanks!

On Sat, Jan 9, 2010 at 5:36 PM, Olivier Lamy <ol...@apache.org> wrote:
> Hi,
> You can try with configuring the resources mojo as this :
>
> <useDefaultDelimiters>false</useDefaultDelimiters>
> <delimiters>
>  <delimiter>${*}</delimiter>
> </delimiters>
>
> The @ won't be use as delimiter.
>
> --
> Olivier
>
> 2010/1/8 Karel Vervaeke <ka...@outerthought.org>:
>> I'm having difficulties with resource filtering
>>
>> In my pom I have:
>>
>>          <resource>
>>            <targetPath>some path</targetPath>
>>            <filtering>true</filtering>
>>            <directory>${basedir}/src/main/xpatch</directory>
>>            <includes><include>*</include></includes>
>>          </resource>
>> ....
>>          <plugin>
>>            <groupId>org.apache.maven.plugins</groupId>
>>            <artifactId>maven-resources-plugin</artifactId>
>>            <configuration>
>>              <escapeString>\</escapeString>
>>            </configuration>
>>          </plugin>
>>
>> in src/main/xpatch I have:
>>
>> <?xml version="1.0"?>
>> <patches xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>>  <patch xpath="/runtime/containers"
>>      remove="artifact[@id='competent']"/>
>>  <patch xpath="/runtime/containers"
>>      remove="artifact[@id='doctasks']"/>
>>  <patch xpath="/runtime/containers" insert-after="artifact[@id='workflow']">
>>    <artifact id="doctasks" groupId="daisy"
>> artifactId="daisy-doctaskrunner-server-impl" version="${myversion}"/>
>>    <artifact id="doctasks" groupId="daisy"
>> artifactId="daisy-doctaskrunner-server-impl" version="${myversion} "/>
>>    <artifact id="workflow" groupId="daisy"
>> artifactId="daisy-workflow-server-impl" version="${myversion}"/>
>>  </patch>
>> </patches>
>>
>> In the output, ${myversion} is not replaced.
>> I have determined that the problem is caused by the fact that the @ is also a
>>
>> I have also tried escaping the @ using the escape string defined in the pom,
>> but then the output looks like this::
>>  <patch xpath="/runtime/containers"
>>      remove="artifact[@id='competent']"/>
>>
>>  <patch xpath="/runtime/containers"
>>      remove="artifact[\@id='doctasks']"/>
>>
>>  <patch xpath="/runtime/containers" insert-after="artifact[\@id='workflow']">
>> ...
>>
>> (The first \@ is escaped, but for the others nothing happens.  IIUC
>> this has to do with the fact that the escape string is used to escape
>> pairs of at signs, but that seems like a strange way to handle
>> things).
>>
>> I found some more info here:
>> http://maven.apache.org/shared/maven-filtering/, but nothing that
>> helped
>> In the end I ended up defining a property at=@ and using ${at} in my
>> resource, which works but isn't very nice.
>>
>> Does anyone have ideas about this?
>> Regards,
>> Karel0
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
>
> --
> Olivier
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Resource filtering difficulties.

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
You can try with configuring the resources mojo as this :

<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
  <delimiter>${*}</delimiter>
</delimiters>

The @ won't be use as delimiter.

--
Olivier

2010/1/8 Karel Vervaeke <ka...@outerthought.org>:
> I'm having difficulties with resource filtering
>
> In my pom I have:
>
>          <resource>
>            <targetPath>some path</targetPath>
>            <filtering>true</filtering>
>            <directory>${basedir}/src/main/xpatch</directory>
>            <includes><include>*</include></includes>
>          </resource>
> ....
>          <plugin>
>            <groupId>org.apache.maven.plugins</groupId>
>            <artifactId>maven-resources-plugin</artifactId>
>            <configuration>
>              <escapeString>\</escapeString>
>            </configuration>
>          </plugin>
>
> in src/main/xpatch I have:
>
> <?xml version="1.0"?>
> <patches xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>  <patch xpath="/runtime/containers"
>      remove="artifact[@id='competent']"/>
>  <patch xpath="/runtime/containers"
>      remove="artifact[@id='doctasks']"/>
>  <patch xpath="/runtime/containers" insert-after="artifact[@id='workflow']">
>    <artifact id="doctasks" groupId="daisy"
> artifactId="daisy-doctaskrunner-server-impl" version="${myversion}"/>
>    <artifact id="doctasks" groupId="daisy"
> artifactId="daisy-doctaskrunner-server-impl" version="${myversion} "/>
>    <artifact id="workflow" groupId="daisy"
> artifactId="daisy-workflow-server-impl" version="${myversion}"/>
>  </patch>
> </patches>
>
> In the output, ${myversion} is not replaced.
> I have determined that the problem is caused by the fact that the @ is also a
>
> I have also tried escaping the @ using the escape string defined in the pom,
> but then the output looks like this::
>  <patch xpath="/runtime/containers"
>      remove="artifact[@id='competent']"/>
>
>  <patch xpath="/runtime/containers"
>      remove="artifact[\@id='doctasks']"/>
>
>  <patch xpath="/runtime/containers" insert-after="artifact[\@id='workflow']">
> ...
>
> (The first \@ is escaped, but for the others nothing happens.  IIUC
> this has to do with the fact that the escape string is used to escape
> pairs of at signs, but that seems like a strange way to handle
> things).
>
> I found some more info here:
> http://maven.apache.org/shared/maven-filtering/, but nothing that
> helped
> In the end I ended up defining a property at=@ and using ${at} in my
> resource, which works but isn't very nice.
>
> Does anyone have ideas about this?
> Regards,
> Karel0
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
Olivier

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