In order to unpack a file from a dependent artifact you can also use 
dependency:unpack.
e.g. 

                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>unpack</id>
                                                <phase>initialize</phase>
                                                <goals>
                                                        <goal>unpack</goal>
                                                </goals>
                                                <configuration>
                                                        <artifactItems>
                                                                <artifactItem>
                                                                        
<groupId>com.company</groupId>
                                                                        
<artifactId>artifact</artifactId>
                                                                        
<version>1.0-SNAPSHOT</version>
                                                                        
<outputDirectory>${temp.directory}</outputDirectory>
                                                                        
<includes>the file you want</includes>
                                                                </artifactItem>
                                                        </artifactItems>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>

Unfortunately you cannot extract the files in a flat hierarchy. 

I used the jetspeed plugin for that.

<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-unpack-maven-plugin</artifactId>





-----Ursprüngliche Nachricht-----
Von: Edelson, Justin [mailto:justin.edel...@mtvstaff.com] 
Gesendet: Montag, 5. Oktober 2009 18:33
An: Maven Users List
Betreff: RE: Ant Mojo Resources

As far as I know, Windows has no facility for executing batch scripts
(or anything else for that matter) which are inside a JAR file. So, what
you'll need to do is copy the script to a temp directory and execute it
from there. I'm not sure how you'd do this with Ant. In a Java-based
Mojo, you could call getResourceAsStream() to get an InputStream and the
copy the bytes to the temp file.

Justin 

-----Original Message-----
From: yoyomohan [mailto:chandramohan....@gmail.com] 
Sent: Sunday, October 04, 2009 2:02 PM
To: users@maven.apache.org
Subject: Re: Ant Mojo Resources


Hi jslinnha,

   I'm stuck in the same problem .pls. can you share the solution for
the problem 'calling scripts from custom ant plugin jar file' only.
 Thanks in advance.....
 

jslinnha wrote:
> 
> Hi All,
>  
> I have created an Ant based plugin that need to call a windows batch 
> file.  The batch file is in the plugin projects resources folder and 
> thus in the plugin jar.  How can I access this resource path/ batch 
> file using the <exec> ant task ?
>  
> Thanks
> 
> Jon
> 
> 

--
View this message in context:
http://www.nabble.com/Ant-Mojo-Resources-tp7011696p25740443.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


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


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

Reply via email to