>>>>> "PL" == Phillip Lord <[EMAIL PROTECTED]> writes:

  PL> I've been trying to create a maven archetype. The problem that I am
  PL> having is that I am using a class resource. So, for example, if I have a
  PL> artifact.xml which looks like this....


  PL> <archetype>
  PL>   <id>archetype-r-tool</id> <sources>
  PL>     <source>src/main/java/RAverageProcessor.java</source>
  PL>   </sources> <testSources>
  PL>     <source>src/test/java/RAverageProcessorTest.java</source>
  PL>   </testSources> <resources>
  PL>     <resource>src/main/resources/averageR.r</resource>
  PL>   </resources>
  PL> </archetype>



  PL> RAverageProcessor.java (and the test) gets moved to a directory which
  PL> depends on the groupId given when the archetype is used. On the other
  PL> hand averageR.r doesn't; it stays resolutely in the root directory.
  PL> Which breaks projects build on this archetype because RAverageProcessor
  PL> loads averageR.r as a class resource.

  PL> So it has to be in the same directory...

  PL> Can anyone tell me how I move this resource according to the group id?



In case anyone else has this problem, I poked around and eventually came up
with a solution. Instead of using archetype.xml (which I misnamed artifact.xml
in the first email), you can use archetype-metadata.xml (which rather
confusingly contains XML with outer tag archetype-descriptor). This allows you
to turn packaging on or off as you want. Here's the equivalent file. 

Hope this helps someone. 

Phil


<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="basic">

  <fileSets>
    <fileSet filtered="true" packaged="true">
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.java</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" packaged="true">
      <directory>src/test/java</directory>
      <includes>
        <include>**/*.java</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" packaged="true">
      <directory>src/main/resources</directory>
      <includes>
        <include>**/*.r</include>
      </includes>
    </fileSet>
  </fileSets>
  
</archetype-descriptor>

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

Reply via email to