preslavrachev / maven-play-plugin

Automatically exported from code.google.com/p/maven-play-plugin
0 stars 0 forks source link

Filters to build for specific environment #105

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. environment specific files, are kept in filters folder.
2. in application.conf file, entries are added like my.url=${my.dev.url}
3. Use <filters> plugin and values aren't filtered
hello, I was trying to use filters(in the conf directory) from your plugin. can 
i do that? <plugin>

<groupId>com.google.code.maven-play-plugin</groupId> 
<artifactId>play-maven-plugin</artifactId> <version>1.0.0-beta1</version> 
<extensions>true</extensions> <filters>
<filter>filters/${environment}.properties</filter>
</filters>
</plugin>

========

<plugin>

<groupId>com.google.code.maven-play-plugin</groupId> 
<artifactId>play-maven-plugin</artifactId> <extensions>true</extensions>
<configuration>
<filters>
<filter>filters/dev.properties</filter>
</filters> <webResources>
<resource>
<directory>conf/</directory> <includes>
<include>.</include>
</includes> <filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
========

What is the expected output? What do you see instead?
Expected to see values filtered.  But it just appears without being filtered

What version of the product are you using? On what operating system?
1.2.4 java, windows linux

Please provide any additional information below.

Original issue reported on code.google.com by martin.j...@gmail.com on 2 Jul 2012 at 5:04

GoogleCodeExporter commented 9 years ago
With packaging mojos (zip, war, dist) this is not a problem. "application.conf" 
file in application's "conf" directory is unfiltered , "conf/application.conf" 
file in destination archive (or directory for: dist-exploded, war-exploded, 
war-inplace mojos) is filtered.

But there is a problem with about Play! server starting mojos (run, test, 
start, precompile). The file "application.conf" in application's "conf" 
directory should be both unfiltered and filtered (for Play! Framework this file 
location and name is not configurable). So we have a problem. The unfiltered 
file should be in different location or have different name to allow filtering 
and not overwrite itself. But this is not compatible with pure Play! (you could 
not successfully execute "play start" for example).

Original comment by gslowiko...@gmail.com on 5 Jul 2012 at 8:06

GoogleCodeExporter commented 9 years ago
Martin, any suggestions?

Original comment by gslowiko...@gmail.com on 30 Jul 2012 at 6:47

GoogleCodeExporter commented 9 years ago
to make it consistent across play and maven build, I beleieve changes needs
to happens on both places(atleast that's what i am envisioning)

maven build will be fine with unfiltered file and after war, having a
filtered file...

in play like play run %dev  can we have something like play run #filter:dev

Original comment by martin.j...@gmail.com on 31 Jul 2012 at 2:13

GoogleCodeExporter commented 9 years ago
I wouldn't expect anything like that from Play! 1.2 line (they suspended almost 
all activity in this branch).

I could add filtering for packaging mojos, but this does not make sense because 
running Play! server (for unit and Selenium testing), precompiling, and perhaps 
many more functionalities would have to operate on unfiltered 
"application.conf" file and would not work properly.

If we would not find a trick how to workaround this, I say it's impossible to 
implement.

Original comment by gslowiko...@gmail.com on 2 Aug 2012 at 8:31

GoogleCodeExporter commented 9 years ago
Can we have something like filter and copy resources.

<resources>
  <resource>

 </resource

Original comment by martin.j...@gmail.com on 2 Aug 2012 at 2:00

GoogleCodeExporter commented 9 years ago
Can we have something like filter and copy resources.

<filterNCopyResources>
  <resource>
         <location>../properties</lcoation>
         <filtering>true</filtering>
         <filterBy>./fileters/dev.filter</filter>
         <copyFilteredFile>
                 <destination>./conf</destination>
         </copyFilteredFile>
 </resource>
</filterNCopyResources>

application.conf file will have non filtered version.  But we could have
filterNCopyResources with many resources to filter file/files and copy it
to destinartion folder.

It wouldn't hinder play server and we could aslo have filtered files.  One
caveat I see is, there would be a duplication of files to be filtered.

Original comment by martin.j...@gmail.com on 2 Aug 2012 at 2:07