You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by zm <zz...@hotmail.com> on 2007/11/13 16:02:56 UTC

Filtering Resources : Maven Properties for username & builddate

Hi,

I'm finishing a pom.xml file, and I need some resource filtering.

Let's say I have a resource file named: build.properties:

build.date=${build.date}
build.version=${project.parent.version}
build.author=${build.username}

In my pom.xml, I have the following block:

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		...
	</build>

Running the application, the given properties will be loaded and displayed.

Now I need a way of defining them with the filter feature.

I know that the META-INF folder will have a MANIFEST.MF generated by maven,
with the entry Built-By: <username> (where I assume username to be the
system user).

Is there a way of using that value in filtering?

What about accessing the build timestamp? I would like to format the
${build.date} with something like '2007.11.13 15:05:30.123'. Any way of
doing it?

Also I could use an ANT task to create properties (<property .../>). Is
there a way of including an ant task, define a property then use it with
filtering?


Many thanks.
-- 
View this message in context: http://www.nabble.com/Filtering-Resources-%3A-Maven-Properties-for-username---builddate-tf4798288s177.html#a13727498
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: Filtering Resources : Maven Properties for username & builddat

Posted by Wayne Fay <wa...@gmail.com>.
This comes up pretty often. Search this lists' archives (in Nabble)
for "timestamp".

Wayne

On 11/13/07, zm <zz...@hotmail.com> wrote:
>
> Hi,
>
> I'm finishing a pom.xml file, and I need some resource filtering.
>
> Let's say I have a resource file named: build.properties:
>
> build.date=${build.date}
> build.version=${project.parent.version}
> build.author=${build.username}
>
> In my pom.xml, I have the following block:
>
>        <build>
>                <resources>
>                        <resource>
>                                <directory>src/main/resources</directory>
>                                <filtering>true</filtering>
>                        </resource>
>                </resources>
>                ...
>        </build>
>
> Running the application, the given properties will be loaded and displayed.
>
> Now I need a way of defining them with the filter feature.
>
> I know that the META-INF folder will have a MANIFEST.MF generated by maven,
> with the entry Built-By: <username> (where I assume username to be the
> system user).
>
> Is there a way of using that value in filtering?
>
> What about accessing the build timestamp? I would like to format the
> ${build.date} with something like '2007.11.13 15:05:30.123'. Any way of
> doing it?
>
> Also I could use an ANT task to create properties (<property .../>). Is
> there a way of including an ant task, define a property then use it with
> filtering?
>
>
> EDIT:
>
> Ok, I've changed the properties file to:
>
> build.date=${build.date}
> build.version=${project.parent.version}
> build.author=${user.name}
> build.javaversion=${java.version}
>
> Now I have everything but the build date, which I would like to format as a
> timestamp. Any tips on how to include/access such a property in filtering?
>
>
>
> Many thanks.
> --
> View this message in context: http://www.nabble.com/Filtering-Resources-%3A-Maven-Properties-for-username---builddate-tf4798288s177.html#a13727498
> 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
>
>

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