J. Wang
J. Wang

Reputation: 81

Maven archetype not substituting properties for module directory name

I created an archetype of a multi-module project, and my intention is to substitute required property __implementation__ for directory names. The result is, __rootArtifactId__ was substituted, but the __impelementation__ was not.

archetype-metadata.xml:

<module id="${rootArtifactId}-${implementation}-impl" dir="__rootArtifactId__-__implementation__-impl" name="${rootArtifactId}-${implementation}-impl">
  <fileSets>
    <fileSet filtered="true" packaged="true" encoding="UTF-8">
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.java</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" encoding="UTF-8">
      <directory></directory>
      <includes>
        <include>pom.xml</include>
      </includes>
    </fileSet>
  </fileSets>
</module>

properties:

artifactId=basic
implementation=foo

resulting directory: basic-__implementationName__-impl

The substitutions happen just fine in: pom.xml and *.java, but have problems with directories

Is there a way to make archetype use properties for directory names?

Upvotes: 1

Views: 843

Answers (1)

J. Wang
J. Wang

Reputation: 81

For this problem I did the following:

  1. cloned maven-archetype source code through git

    git clone --branch maven-archetype-2.4 https://git-wip-us.apache.org/repos/asf/maven-archetype.git
    
  2. Performed the modification mentioned here ARCHETYPE-455

  3. Performed maven install on the maven-archetype project (some unit tests do not work)

    mvn install -DskipTests
    

Afterwards, directory names are correctly replaced.

Upvotes: 1

Related Questions