0

Currently I'm working on a maven build script and my next issue is to copy source files into a target folder. I found this thread and it works fine unless I don't use the 'flattern' attribute. I know that the computer makes all things right, but I wonder why the build will fail.

Here my code using the maven antrun plugin:

<build>
 <plugins>
  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
     <execution>
      <phase>process-resources</phase>
      <configuration>
       <target>
        <copy todir="${project.basedir}/target"  flattern="true" overwrite="true">
         <fileset dir="${project.basedir}/src/main"/>
        </copy>
       </target>
      </configuration>
      <goals>
       <goal>run</goal>
      </goals>
     </execution>
    </executions>
  </plugin>
 </plugins>
</build>

The error message I get is

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project setup_core: An Ant BuildException has occured: copy doesn't support the "flattern" attribute
[ERROR] around Ant part ...<copy todir="C:\Projekte\CQ5_Migration\setup\core_upload/target" overwrite="true" flattern="true">... @ 4:101 in C:\Projekte\CQ5_Migration\setup\core_upload\target\antrun\build-main.xml: The <copy> type doesn't support the "flattern" attribute.
[ERROR] -> [Help 1]

Have I overseen somthing and if so what is/are the missing fact(s)?

Thanks again for your help :-)

Community
  • 1
  • 1
Reporter
  • 3,897
  • 5
  • 33
  • 47
  • Can you tell why are you trying to copy src files to the target folder? Sounds a little bit weird. – khmarbaise Jul 06 '12 at 14:03
  • I'm relativly new in maven and this was a test to create the basic steps. – Reporter Jul 06 '12 at 14:05
  • For what purpose do you copy the src files into the target folder? What would you like to achieve? compiling? code generation? – khmarbaise Jul 06 '12 at 14:18
  • Nothing special. for my current task I tried to copy files from one folder into another. As I said this was the first step. Now I know that it works I will use the right paths. The task is to copy source files from fore different projects folders into one and create one jar file. – Reporter Jul 06 '12 at 14:46
  • But that's not the way maven works. You should put the files into the correct location (src/main/java) and your unit tests to src/test/java. The appropriate resources into src/main/resources and for tests src/test/resources. – khmarbaise Jul 06 '12 at 16:02
  • Don't worry. I can assure you it was just a simple test. Because I can't use the scm plugin for checking out the sources I have to copy those and I will keep the folder structure. – Reporter Jul 08 '12 at 11:40

1 Answers1

1

It should be "flatten" not "flattern".

Remove the 'r'.

mamboking
  • 4,559
  • 23
  • 27