You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Delbecq <de...@meteo.be> on 2011/04/20 22:57:32 UTC

Only partial filtering of .bat with assembly

Hello, 

i try to have some .bat files filtered by assembly plugin. However, for some reason, any batch line that starts with a @ is ignored by filterer :/ 
This is a big problem considering 90% of the script lines starts with a @. Is there some way to have filter don't ignore those lines? 


my source batch file: 

example ${pom.version} 
@java -jar .\lib\dvp-latexrenderer-${pom.version}.jar .\..\documents\%1\%1.xml .\..\documents\%1\%1-latex.xml images 
The output i get: 

example 1.0-SNAPSHOT 
@java -jar .\lib\dvp-latexrenderer-${pom.version}.jar .\..\documents\%1\%1.xml .\..\documents\%1\%1-latex.xml images 



Here is my assembly configuration by the way 
<fileSet> 
<includes><include>*</include></includes> 
<directory>src/assembly/script/</directory> 
<filtered>true</filtered> 
<directoryMode>0755</directoryMode> 
<fileMode>0755</fileMode> 
</fileSet> 


Re: Only partial filtering of .bat with assembly

Posted by "Asmann, Roland" <Ro...@adesso.at>.
You might want to configure it to work around a bug though:

<artifactId>maven-resources-plugin</artifactId>
<configuration>
   <delimiters>
     <delimiter>${*}</delimiter>
   </delimiters>
   <useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>

Roland


On 21.04.2011 13:38, Asmann, Roland wrote:
> How about you don't let the assembly-plugin copy your resources, but
> have the resources-plugin do it?
>
> Roland
>
>
> On 21.04.2011 13:31, David Delbecq wrote:
>  > Thanks for the hint, but not an option. The bat does not only call the
>  > jar file, it actually does some logic on parameters, call several
>  > applications, manage temporary files.
>  >
>  > We are migrating to maven an application that mixes together .bat/.sh,
>  > java jars and perl scripts..
>  > We will later migrate to full java if possible, but one step at a time ;)
>  >
>  > ----- Mail original -----
>  >
>  > De: "Karl Heinz Marbaise" <ka...@soebes.de>
>  > À: users@maven.apache.org
>  > Envoyé: Jeudi 21 Avril 2011 11:26:17
>  > Objet: Re: Only partial filtering of .bat with assembly
>  >
>  > Hi,
>  >
>  > it looks like you are trying to build a BAT file which will call your
> java
>  > code...But for this purposes i would take a deeper look into the
>  > maven-appassembler-plugin which produces such kind of batch-file
>  > automatically...
>  >
>  > http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/
>  >
>  > Kind regards
>  > Karl Heinz Marbaise
>  >
>  > -----
>  > Kind regards
>  > Karl Heinz Marbaise
>  > ----
>  > http://www.soebes.de
>  > http://www.skmwiki.de
>  > http://supose.org/wiki/supose
>  > --
>  > View this message in context:
>  >
> http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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
>  >
>  >
>
> --
> Roland Asmann
> Senior Software Engineer
>
> adesso Austria GmbH
> Floridotower 26. Stock T +43 1 2198790-27
> Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
> A-1210 Wien M +43 664 88657566
> E roland.asmann@adesso.at
> W www.adesso.at
>
> -------------------------------------------------------------
>  >>> business. people. technology. <<<
> -------------------------------------------------------------
>

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock              T +43 1 2198790-27
Floridsdorfer Hauptstr. 1           F +43 1 2198790-927
A-1210 Wien                         M +43 664 88657566
                                    E roland.asmann@adesso.at
                                    W www.adesso.at

-------------------------------------------------------------
             >>> business. people. technology. <<<
-------------------------------------------------------------

Re: Only partial filtering of .bat with assembly

Posted by David Delbecq <de...@meteo.be>.
Could be a solution, i'll give it a try. 

----- Mail original -----

De: "Roland Asmann" <Ro...@adesso.at> 
À: users@maven.apache.org 
Envoyé: Jeudi 21 Avril 2011 13:17:38 
Objet: Re: Only partial filtering of .bat with assembly 

The way I would do it, is create a directory called 
'src/main/filter-resources' (or something similar, just NOT the default 
'src/main/resources'!) and then configure the resource-plugin to run 
'resources:copy-resources' to eg 'target/filtered-resources'. With 
filtering turned on of course. :-) 

Then you have the assembly-plugin configured to use 
'target/filtered-resources' as input (resources? I'm not very familiar 
with the assembly-plugin!) for your assembly. 

I think this would do the trick. Just remember what I wrote in the 
parallel mail -- make sure you work around the @-bug! 

Roland 


On 21.04.2011 14:11, David Delbecq wrote: 
> well, if i mark them as "ressource" they will be put in the jar file, no? 
> 
> ----- Mail original ----- 
> 
> De: "Roland Asmann" <Ro...@adesso.at> 
> À: users@maven.apache.org 
> Envoyé: Jeudi 21 Avril 2011 12:38:44 
> Objet: Re: Only partial filtering of .bat with assembly 
> 
> How about you don't let the assembly-plugin copy your resources, but 
> have the resources-plugin do it? 
> 
> Roland 
> 
> 
> On 21.04.2011 13:31, David Delbecq wrote: 
> > Thanks for the hint, but not an option. The bat does not only call the 
> > jar file, it actually does some logic on parameters, call several 
> > applications, manage temporary files. 
> > 
> > We are migrating to maven an application that mixes together .bat/.sh, 
> > java jars and perl scripts.. 
> > We will later migrate to full java if possible, but one step at a time ;) 
> > 
> > ----- Mail original ----- 
> > 
> > De: "Karl Heinz Marbaise" <ka...@soebes.de> 
> > À: users@maven.apache.org 
> > Envoyé: Jeudi 21 Avril 2011 11:26:17 
> > Objet: Re: Only partial filtering of .bat with assembly 
> > 
> > Hi, 
> > 
> > it looks like you are trying to build a BAT file which will call your 
> java 
> > code...But for this purposes i would take a deeper look into the 
> > maven-appassembler-plugin which produces such kind of batch-file 
> > automatically... 
> > 
> > http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/ 
> > 
> > Kind regards 
> > Karl Heinz Marbaise 
> > 
> > ----- 
> > Kind regards 
> > Karl Heinz Marbaise 
> > ---- 
> > http://www.soebes.de 
> > http://www.skmwiki.de 
> > http://supose.org/wiki/supose 
> > -- 
> > View this message in context: 
> > 
> http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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 
> > 
> > 
> 
> -- 
> Roland Asmann 
> Senior Software Engineer 
> 
> adesso Austria GmbH 
> Floridotower 26. Stock T +43 1 2198790-27 
> Floridsdorfer Hauptstr. 1 F +43 1 2198790-927 
> A-1210 Wien M +43 664 88657566 
> E roland.asmann@adesso.at 
> W www.adesso.at 
> 
> ------------------------------------------------------------- 
> >>> business. people. technology. <<< 
> ------------------------------------------------------------- 
> 

-- 
Roland Asmann 
Senior Software Engineer 

adesso Austria GmbH 
Floridotower 26. Stock T +43 1 2198790-27 
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927 
A-1210 Wien M +43 664 88657566 
E roland.asmann@adesso.at 
W www.adesso.at 

------------------------------------------------------------- 
>>> business. people. technology. <<< 
------------------------------------------------------------- 


Re: Only partial filtering of .bat with assembly

Posted by "Asmann, Roland" <Ro...@adesso.at>.
The way I would do it, is create a directory called 
'src/main/filter-resources' (or something similar, just NOT the default 
'src/main/resources'!) and then configure the resource-plugin to run 
'resources:copy-resources' to eg 'target/filtered-resources'. With 
filtering turned on of course. :-)

Then you have the assembly-plugin configured to use 
'target/filtered-resources' as input (resources? I'm not very familiar 
with the assembly-plugin!) for your assembly.

I think this would do the trick. Just remember what I wrote in the 
parallel mail -- make sure you work around the @-bug!

Roland


On 21.04.2011 14:11, David Delbecq wrote:
> well, if i mark them as "ressource" they will be put in the jar file, no?
>
> ----- Mail original -----
>
> De: "Roland Asmann" <Ro...@adesso.at>
> À: users@maven.apache.org
> Envoyé: Jeudi 21 Avril 2011 12:38:44
> Objet: Re: Only partial filtering of .bat with assembly
>
> How about you don't let the assembly-plugin copy your resources, but
> have the resources-plugin do it?
>
> Roland
>
>
> On 21.04.2011 13:31, David Delbecq wrote:
>  > Thanks for the hint, but not an option. The bat does not only call the
>  > jar file, it actually does some logic on parameters, call several
>  > applications, manage temporary files.
>  >
>  > We are migrating to maven an application that mixes together .bat/.sh,
>  > java jars and perl scripts..
>  > We will later migrate to full java if possible, but one step at a time ;)
>  >
>  > ----- Mail original -----
>  >
>  > De: "Karl Heinz Marbaise" <ka...@soebes.de>
>  > À: users@maven.apache.org
>  > Envoyé: Jeudi 21 Avril 2011 11:26:17
>  > Objet: Re: Only partial filtering of .bat with assembly
>  >
>  > Hi,
>  >
>  > it looks like you are trying to build a BAT file which will call your
> java
>  > code...But for this purposes i would take a deeper look into the
>  > maven-appassembler-plugin which produces such kind of batch-file
>  > automatically...
>  >
>  > http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/
>  >
>  > Kind regards
>  > Karl Heinz Marbaise
>  >
>  > -----
>  > Kind regards
>  > Karl Heinz Marbaise
>  > ----
>  > http://www.soebes.de
>  > http://www.skmwiki.de
>  > http://supose.org/wiki/supose
>  > --
>  > View this message in context:
>  >
> http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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
>  >
>  >
>
> --
> Roland Asmann
> Senior Software Engineer
>
> adesso Austria GmbH
> Floridotower 26. Stock T +43 1 2198790-27
> Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
> A-1210 Wien M +43 664 88657566
> E roland.asmann@adesso.at
> W www.adesso.at
>
> -------------------------------------------------------------
>  >>> business. people. technology. <<<
> -------------------------------------------------------------
>

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock              T +43 1 2198790-27
Floridsdorfer Hauptstr. 1           F +43 1 2198790-927
A-1210 Wien                         M +43 664 88657566
                                    E roland.asmann@adesso.at
                                    W www.adesso.at

-------------------------------------------------------------
             >>> business. people. technology. <<<
-------------------------------------------------------------

Re: Only partial filtering of .bat with assembly

Posted by David Delbecq <de...@meteo.be>.
well, if i mark them as "ressource" they will be put in the jar file, no? 

----- Mail original -----

De: "Roland Asmann" <Ro...@adesso.at> 
À: users@maven.apache.org 
Envoyé: Jeudi 21 Avril 2011 12:38:44 
Objet: Re: Only partial filtering of .bat with assembly 

How about you don't let the assembly-plugin copy your resources, but 
have the resources-plugin do it? 

Roland 


On 21.04.2011 13:31, David Delbecq wrote: 
> Thanks for the hint, but not an option. The bat does not only call the 
> jar file, it actually does some logic on parameters, call several 
> applications, manage temporary files. 
> 
> We are migrating to maven an application that mixes together .bat/.sh, 
> java jars and perl scripts.. 
> We will later migrate to full java if possible, but one step at a time ;) 
> 
> ----- Mail original ----- 
> 
> De: "Karl Heinz Marbaise" <ka...@soebes.de> 
> À: users@maven.apache.org 
> Envoyé: Jeudi 21 Avril 2011 11:26:17 
> Objet: Re: Only partial filtering of .bat with assembly 
> 
> Hi, 
> 
> it looks like you are trying to build a BAT file which will call your java 
> code...But for this purposes i would take a deeper look into the 
> maven-appassembler-plugin which produces such kind of batch-file 
> automatically... 
> 
> http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/ 
> 
> Kind regards 
> Karl Heinz Marbaise 
> 
> ----- 
> Kind regards 
> Karl Heinz Marbaise 
> ---- 
> http://www.soebes.de 
> http://www.skmwiki.de 
> http://supose.org/wiki/supose 
> -- 
> View this message in context: 
> http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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 
> 
> 

-- 
Roland Asmann 
Senior Software Engineer 

adesso Austria GmbH 
Floridotower 26. Stock T +43 1 2198790-27 
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927 
A-1210 Wien M +43 664 88657566 
E roland.asmann@adesso.at 
W www.adesso.at 

------------------------------------------------------------- 
>>> business. people. technology. <<< 
------------------------------------------------------------- 


Re: Only partial filtering of .bat with assembly

Posted by "Asmann, Roland" <Ro...@adesso.at>.
How about you don't let the assembly-plugin copy your resources, but 
have the resources-plugin do it?

Roland


On 21.04.2011 13:31, David Delbecq wrote:
> Thanks for the hint, but not an option. The bat does not only call the
> jar file, it actually does some logic on parameters, call several
> applications, manage temporary files.
>
> We are migrating to maven an application that mixes together .bat/.sh,
> java jars and perl scripts..
> We will later migrate to full java if possible, but one step at a time ;)
>
> ----- Mail original -----
>
> De: "Karl Heinz Marbaise" <ka...@soebes.de>
> À: users@maven.apache.org
> Envoyé: Jeudi 21 Avril 2011 11:26:17
> Objet: Re: Only partial filtering of .bat with assembly
>
> Hi,
>
> it looks like you are trying to build a BAT file which will call your java
> code...But for this purposes i would take a deeper look into the
> maven-appassembler-plugin which produces such kind of batch-file
> automatically...
>
> http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/
>
> Kind regards
> Karl Heinz Marbaise
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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
>
>

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock              T +43 1 2198790-27
Floridsdorfer Hauptstr. 1           F +43 1 2198790-927
A-1210 Wien                         M +43 664 88657566
                                    E roland.asmann@adesso.at
                                    W www.adesso.at

-------------------------------------------------------------
             >>> business. people. technology. <<<
-------------------------------------------------------------

Re: Only partial filtering of .bat with assembly

Posted by David Delbecq <de...@meteo.be>.
Thanks for the hint, but not an option. The bat does not only call the jar file, it actually does some logic on parameters, call several applications, manage temporary files. 

We are migrating to maven an application that mixes together .bat/.sh, java jars and perl scripts.. 
We will later migrate to full java if possible, but one step at a time ;) 

----- Mail original -----

De: "Karl Heinz Marbaise" <ka...@soebes.de> 
À: users@maven.apache.org 
Envoyé: Jeudi 21 Avril 2011 11:26:17 
Objet: Re: Only partial filtering of .bat with assembly 

Hi, 

it looks like you are trying to build a BAT file which will call your java 
code...But for this purposes i would take a deeper look into the 
maven-appassembler-plugin which produces such kind of batch-file 
automatically... 

http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/ 

Kind regards 
Karl Heinz Marbaise 

----- 
Kind regards 
Karl Heinz Marbaise 
---- 
http://www.soebes.de 
http://www.skmwiki.de 
http://supose.org/wiki/supose 
-- 
View this message in context: http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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: Only partial filtering of .bat with assembly

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,

it looks like you are trying to build a BAT file which will call your java
code...But for this purposes i would take a deeper look into the
maven-appassembler-plugin which produces such kind of batch-file
automatically...

http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/

Kind regards
Karl Heinz Marbaise

-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Only-partial-filtering-of-bat-with-assembly-tp4329257p4330450.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: Only partial filtering of .bat with assembly

Posted by Marc Rohlfs <po...@googlemail.com>.
I just checked it once more. With the plugin version 2.2, filtering 
didn't work when there was an '@' character somewhere in the document. 
My problem was solved with version 2.2.1, but in my case there wasn't an 
'@' character in the same line.

BTW: Your workaround is not bad! Another idea would be adding a foo 
property to the statement: -Dfix=@. Filtering works, if there's an even 
number of '@' characters.

Formally (e.g. with Maven 1) filter tokens looked like this: @propname@. 
I think the problem is sort of a relic ...

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


Re: Only partial filtering of .bat with assembly

Posted by David Delbecq <de...@meteo.be>.
am using 2.2.1 
Your report say that the fil is not filtered it it contains an @ 
My problem is that lines started with an @ are not filtered other ones are fine. 


<plugin>
        <!-- NOTE: We don't need a groupId specification because the group is
             org.apache.maven.plugins ...which is assumed by default.
         -->
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2.1</version>
        <configuration>
          <filters>
            <filter>${basedir}/filter.properties</filter>
          </filters>

          <descriptors>
            <descriptor>assembly-kit.xml</descriptor>
            <descriptor>assembly-kitcours.xml</descriptor>
            <descriptor>assembly-kitoutils.xml</descriptor>
            <descriptor>assembly-kitpdf.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id> <!-- this is used for inheritance merges -->
            <phase>package</phase> <!-- bind to the packaging phase -->
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>

      </plugin> 

----- Mail original -----

De: "Marc Rohlfs" <po...@googlemail.com> 
À: "Maven Users List" <us...@maven.apache.org> 
Envoyé: Jeudi 21 Avril 2011 11:07:20 
Objet: Re: Only partial filtering of .bat with assembly 

Which version of the plugin do You use? I filed a bug report for this 
problem and it was solved with the plugin version 2.2.1. 

See: http://jira.codehaus.org/browse/MASSEMBLY-528 

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



Re: Only partial filtering of .bat with assembly

Posted by Marc Rohlfs <po...@googlemail.com>.
Which version of the plugin do You use? I filed a bug report for this 
problem and it was solved with the plugin version 2.2.1.

See: http://jira.codehaus.org/browse/MASSEMBLY-528

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


Re: Only partial filtering of .bat with assembly

Posted by David Delbecq <de...@meteo.be>.
The documentation of assembly plugin does not says anything about changing delimiter. Moreover, it does not use maven resource plugin. 
I tried to change my version of m-r-p to a recent one that fixes the @ issue, but assembly does not seem to use it. 
The only workaround i found is to replace all my @ with ${At} and defin At=@ in filter. This create unreadable file on source side :s 

Any other suggestion? 
Should i fill a bug report? 


----- Mail original -----

De: "Wayne Fay" <wa...@gmail.com> 
À: "Maven Users List" <us...@maven.apache.org> 
Envoyé: Mercredi 20 Avril 2011 23:01:48 
Objet: Re: Only partial filtering of .bat with assembly 

> i try to have some .bat files filtered by assembly plugin. However, for some 
> reason, any batch line that starts with a @ is ignored by filterer :/ 
> This is a big problem considering 90% of the script lines starts with a @. Is 
> there some way to have filter don't ignore those lines? 

Pretty sure the assembly plugin uses the same configuration for 
filtering delimiters that m-r-p uses: 
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters 

The delimiter list includes ${*} and @. 

You should be able to override those delimiters somehow. I honestly 
don't know the proper configuration as I've never needed to do this 
myself, but probably you can configure <delimiters> in <configuration> 
somewhere. 

Wayne 

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



Re: Only partial filtering of .bat with assembly

Posted by Wayne Fay <wa...@gmail.com>.
> i try to have some .bat files filtered by assembly plugin. However, for some
> reason, any batch line that starts with a @ is ignored by filterer :/
> This is a big problem considering 90% of the script lines starts with a @. Is
> there some way to have filter don't ignore those lines?

Pretty sure the assembly plugin uses the same configuration for
filtering delimiters that m-r-p uses:
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters

The delimiter list includes ${*} and @.

You should be able to override those delimiters somehow. I honestly
don't know the proper configuration as I've never needed to do this
myself, but probably you can configure <delimiters> in <configuration>
somewhere.

Wayne

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