maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte" <rfscho...@apache.org>
Subject Re: How to create new directory in target folder with Maven
Date Sat, 07 Sep 2013 16:51:15 GMT
"I am writing a library"

Just to be sure we're on the same page: are you writing Java code or Ant  
scripts?
And you're not talking about writing a Maven Plugin, right?

In that case it's a plain Java question: File.mkdirs() [1] does the magic
Since you're referring to an open source project, you could also have a  
look at its sources. Not sure if the surefire-plugin is the best example,  
because it does much much more.

Robert

[1] http://docs.oracle.com/javase/6/docs/api/java/io/File.html#mkdirs()


Op Fri, 06 Sep 2013 22:06:05 +0200 schreef Bidlo <petr.mensik1@gmail.com>:

> I am writing a library which will create a report based on the test  
> results
> (imagine something like Surefire). And my problem is, I am able to  
> create a
> folder in target/ directory to hold the report and also copy there  
> necessary
> files but I can do that only when I build the library project itself.
>
> I would like to achieve same behavior like a Surefire plugin has, that  
> means
> if I put dependency for my library to some project, let's say myProject,
> then I will get something like myProject/target/myLibrary after the  
> build.
>
> btw, this is what I currently have
>
> <plugin>
>      <groupId>org.apache.maven.plugins</groupId>
>      <artifactId>maven-antrun-plugin</artifactId>
>      <version>1.7</version>
>          <executions>
>              <execution>
>                 <phase>generate-test-sources</phase>
>                 <configuration>
>                     <tasks>
>                         <echo message="Creating folder for the lib..." />
>                         <mkdir dir="${report.folder}" />
>                         <echo message="Copying Twitter Bootstrap  
> libraries
> to the ${report.folder}" />
>                         <copy todir="${report.folder}">
>                                 <fileset  
> dir="src/main/resources/bootstrap">
>                                     <include name="**/**" />
>                                 </fileset>
>                             </copy>
>                         </tasks>
>                     </configuration>
>                     <goals>
>                         <goal>run</goal>
>                     </goals>
>                 </execution>
>             </executions>
>         </plugin>
>
> I also tried to execute this code inside my library
> FileUtils.copyDirectoryToDirectory(new  
> File("src/main/resources/bootstrap"),
> new File("target/myLibrary") but I will get obvious  
> FileNotFoundException -
> bootstrap doesn't exist in the project which is using the library
>
>
>
> --
> View this message in context:  
> http://maven.40175.n5.nabble.com/How-to-create-new-directory-in-target-folder-with-Maven-tp5769636.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message