Thank you for your reply. I have tried to get your solution working, but I
have not quite succeeded.

To answer your assumption first:
> I'm assuming the nar is just a zip like jars and wars.
Yes, this is true.

This is what I've done:

I created a new jar with the components.xml file containing your
component-set tags in the specified directory path. I used maven to create
and install the jar and ended up with a jar called: narUnArchiver-0.1.jar

I then added the dependency tags as described in your blog post as follows:

...
   <build>
        <plugins>
            <plugin>
                <groupId> org.freehep </groupId>
                <artifactId> freehep-nar-plugin </artifactId>
                <executions>
                    <execution>
                        <id> download-a-nar </id>
                        <phase> package </phase>
                        <goals>
                            <goal> nar-download </goal>
                            <goal> nar-unpack </goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId> narUnArchiver </groupId>
                        <artifactId> narUnArchiver </artifactId>
                        <version> 0.1 </version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
...    
This builds successfully, but the contents of the nar files are not included
in the target directory.

I also tried your other idea of adding it in the build extension:
...
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId> narUnArchiver </groupId>
                <artifactId> narUnArchiver </artifactId>
                <version> 0.1 </version>
            </extension>
         </extensions>
    </build>
...

With the build extension (above) I get a build error:
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal
'org.freehep:freehep-nar-plugin:2.0-alpha-11-SNAPSHOT:nar-unpack': Unable to
find the mojo
'org.freehep:freehep-nar-plugin:2.0-alpha-11-SNAPSHOT:nar-unpack' in the
plugin 'org.freehep:freehep-nar-plugin'
org.codehaus.plexus.archiver.zip.ZipUnArchiver
...
Caused by: java.lang.ClassNotFoundException:
org.codehaus.plexus.archiver.zip.ZipUnArchiver
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

So I believe the error is caused by the library not being found, but it is
in the repository and I've tried including it as a project.dependency and as
build.extensions.extension but to no avail. Any ideas as to what I am
missing here?

Thanks for your time and help!



Brian E Fox wrote:
> 
> I'm assuming the nar is just a zip like jars and wars. If so, you just
> need to map nar to the correct unarchiver and the dependency plugin will
> be able to unpack it.
> 
> Add the following to a jar in META-INF/plexus/components.xml (or just
> drop into src/main/resources/META-INF/plexus/components.xml of a new jar
> project and let maven pack it for you)
> 
> <component-set>
>   <components>          
>     <!-- UnArchiver -->  
>     <component>
>       <role>org.codehaus.plexus.archiver.UnArchiver</role>
>       <role-hint>nar</role-hint>
>       <!-- there is no implementaion of SWCUnArchiver, but ZipUnArchive
> will do the job -->
>  
> <implementation>org.codehaus.plexus.archiver.zip.ZipUnArchiver</implemen
> tation>
>       <instantiation-strategy>per-lookup</instantiation-strategy>
>     </component>        
>   </components>
> </component-set>
> 
> Then add this jar to a dependency section inside the plugin config (as
> shown in [1]) if that doesn't work, then add it as a build extension. If
> you confirm this works, I'll add it to the dependency plugin ( I already
> have added support for SWC this way).
> 
> --Brian
> 
> [1] http://blogs.sonatype.com/brian/2008/04/23/1208965980000.html
> 
> -----Original Message-----
> From: RalphWH [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 13, 2008 8:22 PM
> To: users@maven.apache.org
> Subject: How to copy unpacked nar file contents into target directory?
> 
> 
> Hello All,
> 
> I have a project that is packaging into a jar and is using the
> freehep-nar-plugin to download and unpack the needed .nar files. This
> part
> works great. But what I haven't been able to figure out is how to then
> copy
> the .so files (in the .nar downloaded files) into the packaged .jar or
> into
> the assembly component .zip files. Since the nar files are downloaded
> and
> unpacked in the repository, how can I go about copying them into the
> target/
> directory?
> 
> This is the download and unpack snippet:
>                         <plugin>
>                           <groupId>org.freehep</groupId>
>                           <artifactId>freehep-nar-plugin</artifactId>
>                           <executions>
>                             <execution>
>                                <id>download-nar</id>
>                                <phase>package</phase>
>                                <goals>
>                                  <goal>nar-download</goal>
>                                  <goal>nar-unpack</goal>
>                                </goals>
>                             </execution>
>                           </executions>
>                         </plugin>
> 
> I have tried setting the targetDirectory tag in configuration, but this
> is
> ignored by the unpack goal. I have also tried to use the
> maven-dependency-plugin, but this seems to ignore nar files completely. 
> 
> I've also tried to use mvn's <dependency> tag directly with
> <type>nar</type>, but this doesn't work because the nar file that it
> tries
> to download doesn't include the ${aol} (ex:
> ${file_name}-i386-Linux-g++-shared.nar). It just attached .nar to the
> end of
> the artifactId. 
> 
> It seems like I'm missing something obvious here but I haven't been able
> to
> figure it out. Any ideas would be greatly appreciated. Thanks!
> -- 
> View this message in context:
> http://www.nabble.com/How-to-copy-unpacked-nar-file-contents-into-target
> -directory--tp17834192p17834192.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-copy-unpacked-nar-file-contents-into-target-directory--tp17834192p17875119.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to