Thanks guys! I think I finally got something together that works:

The in pom.xml of the project you want to assemble with the nar .so
libraries:
...
    <build>
        <plugins>
            <plugin>
                <groupId>org.freehep</groupId>
                <artifactId>freehep-nar-plugin</artifactId>
                <configuration>
                    <classifiers>
                        <!-- links this plugin to maven-assembly-plugin
descriptor-->
                        <classifier>narSpLauncher</classifier>
                    </classifiers>
                </configuration>
                <executions>
                    <execution>
                        <id>download-a-nar</id>
                        <phase>package</phase>
                        <goals>
                            <!-- copies the .so nar libraries to target/ in
the current working directory -->
                            <goal>nar-assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                         <descriptor>
                            <your path to
assembly>/src/main/assembly/narSpLauncher.xml
                        </descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
...

<your path to assembly>/src/main/assembly/narSpLauncher.xml
   
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copy the .so nar libraries to the lib directory -->
<assembly>
    <id>sp</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>true</includeBaseDirectory>
    <fileSets>
        <fileSet>
           
<directory>${user.dir}/target/nar/lib/${os.arch}-${os.name}-g++/shared</directory>
            <!-- ${user.dir} - this maven property is used to circumvent a
bug in the nar plugin: NARPLUGIN-171 -->
            <!-- ${os.xxx} - used to make as platform generic as possible
-->
            <outputDirectory>lib</outputDirectory>
            <includes>
                <include>**/*.so</include>
            </includes>
        </fileSet>
        <...add whatever other files you want to include...>
    </fileSets>
</assembly>

So basically, freehep-nar-plugin's goal 'nar-assembly' will copy the
contents of the nar file into the /target directory and the
maven-assembly-plugin is used to create the assembled file. The
freehep-nar-plugin does have a couple of quirks and that is why the
${user.dir} is used in the assembly.fileSets (see: 
http://bugs.freehep.org/browse/NARPLUGIN-171 NARPLUGIN-171 )

Thanks again!


RalphWH wrote:
> 
> 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--tp17834192p18205829.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