views:

100

answers:

1

I'm trying to create an archtype for a simple project, this project contains some ssl certs that i'd like to includes as resources in the archtype so when the project gets created those certs will be part of the project. My problem is that maven is trying to do a property replacement on those certs when creating a project with the archetype. Is there anyway to tell maven not to do the property replacement? I've already tried the following:

    <resources>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
    <includes>
      <include>**/*.xml</include>
    </includes>
  </resource>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>false</filtering>
    <excludes>
      <exclude>**/*.xml</exclude>
    </excludes>
  </resource>

in my prototype POM.xml. Any ideas?

A: 

I'm not sure what your problem exactly is (are your certificates xml files??) but my guess is that it is related to the fact that most of non binary content of an archetype is processed by velocity during creation (see ARCHETYPE-90 about this problem).

A workaround is to configure the create-from-project mojo to have file unfiltered by default using:

-Darchetype.filteredExtentions=ext1,ext2,...

It sets the extensions for files that will be filtered and the default value include java, xml, txt, vm, groovy, jsp, gsp, vm and properties. So exclude xml from this list if you don't want xml to be filtered.

Another option would be to specify custom metadata for your archetype, something like this in src/main/resources/META-INF/maven/archetype-metadata.xml:

<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="myarchetype">
  <fileSets>
    <fileSet filtered="false" encoding="UTF-8">
      <directory>src/foobar</directory>
      <includes>
        <include>**/*.xml</include>
      </includes>
    </fileSet>
  </fileSets>
</archetype-descriptor>

See this page for more details on archetype metadata.

Pascal Thivent