Hi David,

I have used an antrun plugin execution to generate a timestamp
properties file in the "initialize" phase, like this:

<properties>
  ...
  <generated-resources-dir>
    target/generated-resources
  </generated-resources-dir>
  ...
</properties>
<build>
  ...
  <plugins>
    ...
    <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <executions>
        <execution>
          <id>generate-timestamp-properties-file</id>
          <phase>initialize</phase>
          <goals><goal>run</goal></goals>
          <configuration>
            <tasks>
              <mkdir dir="${generated-resources-dir}"/>
              <tstamp>
                <format property="timestamp"
                        pattern="MM/dd/yyyy HH:mm:ss"/>
              </tstamp>
              <delete
                file="${generated-resources-dir}/timestamp.properties"
                failonerror="false"/>
              <echo message="timestamp=${timestamp}"
                file="${generated-resources-dir}/timestamp.properties"/>
            </tasks>
          </configuration>
        </execution>
        ...
      </executions>
    </plugin>
    ...
  </plugins>
  ...
</build>


Hope it helps,
Steve

David Williams wrote:
> Guys,
> 
> Thanks for your responses.  What I really want to do is pass the current
> system date and or time to a properties file.  I already know what I need to
> do to filter in maven but I'm trying to figure out the best way to get these
> variables in a build.properties file for example.  I'm currently using Maven
> 2.0.6.  Some projects are building with java 1.4 and some with java 1.5.
> 
> Thanks again for your responses,
> 
> David
> 
> On 7/31/07, Eric Redmond <[EMAIL PROTECTED]> wrote:
>> That's fine, then stick them in the settings.xml. But you missed my point:
>> "env" access via properties won't be around in the next version of Maven,
>> so
>> they aren't a good suggestion.
>>
>> Eric
>>
>> On 7/31/07, Graham Leggett <[EMAIL PROTECTED]> wrote:
>>> Eric Redmond wrote:
>>>
>>>> I would stick to -D options. "env" variables are going away in Maven
>>> soon.
>>>
>>> -D options are simply command line options, they are not an environment.
>>>
>>> Trying to create a pretend environment using -D violates the principle
>>> of least astonishment in a big way, and is a major headache if you have
>>> system specific information that maven requires, such as the location of
>>> eclipse for the pde-maven-plugin.
>>>
>>> Regards,
>>> Graham
>>
>> --
>> Eric Redmond
>> http://blog.propellors.net


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to