You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Alberti Antoine <aa...@axway.com> on 2010/12/01 19:05:58 UTC

Assembly filtering syntax - properties not filtered

Hi all,

is it possible that the syntax of a file to filter prevents the assembly
plugin from detecting a variable to replace? If I filter the following
run.bat file:
 
--------------------------------
${project.version}
@echo off
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "http_port"
conf\configuration.properties') DO set http_port=%%i
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "control_port"
conf\configuration.properties') DO set control_port=%%i

cmd /C java -jar target\bafana-web-${project.version}-standalone.jar
--httpPort=%http_port% --controlPort=%control_port% %*
--------------------------------

the result is:

--------------------------------
1.0-SNAPSHOT
@echo off
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "http_port"
conf\configuration.properties') DO set http_port=%%i
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "control_port"
conf\configuration.properties') DO set control_port=%%i

cmd /C java -jar target\bafana-web-${project.version}-standalone.jar
--httpPort=%http_port% --controlPort=%control_port% %*
--------------------------------


Note that the first instance of project.version is filtered, but not the
second one. Of course, I added the first one as a test, to verify that
the file was actually filtered.

What should I change in my original file?

Thanks a lot
Antoine Alberti

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


RE: Assembly filtering syntax - properties not filtered

Posted by Alberti Antoine <aa...@axway.com>.
ok, thanks a lot. I'll try this other workaround. 

-----Message d'origine-----
De : Jochen Stiepel [mailto:j.stiepel@gmail.com] 
Envoyé : jeudi 2 décembre 2010 11:54
À : Maven Users List
Objet : Re: Assembly filtering syntax - properties not filtered

Hi Antoine,

as far as I can see this is a known bug. I has to do with the default delimiter "@".  Please see: http://jira.codehaus.org/browse/MRESOURCES-104

CU,

Jochen

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


Re: Assembly filtering syntax - properties not filtered

Posted by Jochen Stiepel <j....@gmail.com>.
Hi Antoine,

> As I'm filtering the file through the assembly plugin, maybe I didn't set it up correctly, or maybe it doesn't use the resource plugin?

I'm not 100% sure, but I think so. The maven-resources-plugin is
different from the maven-assembly-plugin and they don't share the
configuration.

For the maven-assembly-plugin see also here:
http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/filtering-some-distribution-files.html

Maybe you can first use e.g. resources:copy-resources and after that
assemble the now filtered files.

CU,
Jochen

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


RE: Assembly filtering syntax - properties not filtered

Posted by Alberti Antoine <aa...@axway.com>.
Hi Jochen,

I tried to put back my @ character in my file to filter and changed my pom this way:

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <delimiters>
                        <delimiter>${*}</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>make-kit</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/install-kit-descriptor.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

Well... didn't work. I still have my ${project.version} variable in my filtered file.

As I'm filtering the file through the assembly plugin, maybe I didn't set it up correctly, or maybe it doesn't use the resource plugin?

Thanks again.
AA

-----Message d'origine-----
De : Jochen Stiepel [mailto:j.stiepel@gmail.com] 
Envoyé : jeudi 2 décembre 2010 11:54
À : Maven Users List
Objet : Re: Assembly filtering syntax - properties not filtered

Hi Antoine,

as far as I can see this is a known bug. I has to do with the default delimiter "@".  Please see: http://jira.codehaus.org/browse/MRESOURCES-104

CU,

Jochen

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


Re: Assembly filtering syntax - properties not filtered

Posted by Jochen Stiepel <j....@gmail.com>.
Hi Antoine,

as far as I can see this is a known bug. I has to do with the default
delimiter "@".  Please see: http://jira.codehaus.org/browse/MRESOURCES-104

CU,

Jochen

RE: Assembly filtering syntax - properties not filtered

Posted by Alberti Antoine <aa...@axway.com>.
Hi all,
I found it. It's the @ character from @echo off. If I add the property <atChar>@</atChar> and replace my original run.bat with 

--------------------------------
${project.version}
${atChar}echo off
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "http_port"
conf\configuration.properties') DO set http_port=%%i FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "control_port"
conf\configuration.properties') DO set control_port=%%i

cmd /C java -jar target\bafana-web-${project.version}-standalone.jar
--httpPort=%http_port% --controlPort=%control_port% %*
--------------------------------

It works.

Cheers.
AA

-----Message d'origine-----
De : Alberti Antoine [mailto:aalberti@axway.com] 
Envoyé : mercredi 1 décembre 2010 19:06
À : users@maven.apache.org
Objet : Assembly filtering syntax - properties not filtered

Hi all,

is it possible that the syntax of a file to filter prevents the assembly plugin from detecting a variable to replace? If I filter the following run.bat file:
 
--------------------------------
${project.version}
@echo off
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "http_port"
conf\configuration.properties') DO set http_port=%%i FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "control_port"
conf\configuration.properties') DO set control_port=%%i

cmd /C java -jar target\bafana-web-${project.version}-standalone.jar
--httpPort=%http_port% --controlPort=%control_port% %*
--------------------------------

the result is:

--------------------------------
1.0-SNAPSHOT
@echo off
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "http_port"
conf\configuration.properties') DO set http_port=%%i FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "control_port"
conf\configuration.properties') DO set control_port=%%i

cmd /C java -jar target\bafana-web-${project.version}-standalone.jar
--httpPort=%http_port% --controlPort=%control_port% %*
--------------------------------


Note that the first instance of project.version is filtered, but not the second one. Of course, I added the first one as a test, to verify that the file was actually filtered.

What should I change in my original file?

Thanks a lot
Antoine Alberti

---------------------------------------------------------------------
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