Hi Severin,

Here's an undocumented profiles trick:

<profiles>
  <profile>
    <id>undefined-property-value</id>
    <activation>
      <property>
        <name>!my.property.name</name>
      </property>
    </activation>
    <properties>
      <my.property.name>default-value-here</my.property.name>
    </properties>
  </profile>
  ...
</profiles>

The "!" in front of my.property.name in the activation section triggers
the profile if my.property.name is not defined.  This trick also works
with property value-based activation - you can activate a profile when a
named property has some value other than that specified, by prepending
an exclamation point to the value.

Note that profiles in POMs can also have <resources> sections, so you
could set up your property-based inclusions/execlusions/filtering there.

Steve

Severin Ecker wrote:
> hi,
> 
> i was looking for a possibility to include/exclude (and filter) my
> resources depending on the value of a property.
> reading around in different documents and tutorials i found out that i
> can filter my resources using system properties.
> 
> so far so good, but what i couldn't find out is, how to set this system
> property to a default value within the pom file if it wasn't specified
> on the command line (afaik one can only specify/create project
> properties but not system properties in the pom file under
> build/properties right?), or fail to execute any lifecycle if said
> property was not specified.
> what i don't want is to have maven look for resources like
> ${failed.to.specify.property}.
> 
> is there a way to do this?
> 
> oh and a second question.
> how do i exclude all subdirectories of a directory in the resources but
> still include the directory i'm in?
> <excludes>
> <exclude>mydirwithsubdirs/**/*.*</exclude>
> </excludes>
> 
> also excludes 'mydirwithsubdirs' and all its containing files. problem
> is, i don't know/want to explicitely specify the names of all subdirs in
> the pomfile.
> 
> thanks in advance!
> 
> cheers,
> severin



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

Reply via email to