Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create file in project directory with archetype plugin

I want to place a README.md(and maybe some other files) next to the pom.xml of the project that is created by the Maven Archetype plugin.

It seems that it is only allowed to place files

  • <sources> = src/main/java
  • <resources> = src/main/resources
  • <testSources> = src/test/java
  • <testResources> = src/test/resources
  • <siteResources> = src/site

whereas I want to place files in .. How can I do this?

like image 394
oschrenk Avatar asked Jan 18 '13 16:01

oschrenk


1 Answers

To clarify what user1811587 is saying, if you are using an archetype-metadata.xml file, like the one created when generating an archetype through mvn archetype:create-from-project, the format would be:

<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="viewport-bootstrap"
    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <fileSets>
    <fileSet filtered="true" packaged="false" encoding="UTF-8">
      <directory/>
      <includes>
        <include>README.txt</include>
      </includes>
    </fileSet>
  </fileSets>
</archetype-descriptor>

The above XML will place the README.txt along side the pom.xml.

like image 174
Eric Bronnimann Avatar answered Sep 16 '22 14:09

Eric Bronnimann