Hi John,

John Bito wrote at Donnerstag, 5. März 2009 22:50:

> I'm interested in Jörg's experience.  In the documentation, it appears
> that the NAR project artifact is always a jar and the native binaries are
> attached artifacts.  I haven't seen a way to configure NAR to produce an
> a.out executable as the project artifact.  Please inform me how that
> should be done.

we use it either to build a shared DLL (from C or C++ code) that is used as
a plugin for a non-Java application or to create JNI DLLs. One module is
used to create the shard library, in another module we unpack the nar and
create a ZIP (using the assembly plugin, but you might have used also
something like nsis-plugin/izpack-plugin to create an installer).

Settings in the Global POM, that is inherited everywhere:

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
                <groupId>org.freehep</groupId>
                <artifactId>freehep-nar-plugin</artifactId>
                <version>2.0-alpha-10</version>
                <extensions>true</extensions>
                <configuration>
                        
<targetDirectory>${project.build.directory}/nar</targetDirectory>
                </configuration>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    ...
  </build>
  <dependencyManagement>
    <dependencies>
        <dependency>
                <groupId>my.group</groupId>
                <artifactId>simple-plugin</artifactId>
                <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
  </dependencyManagement>



In the POM that builds the shard lib:

        <groupId>my.group</groupId>
        <artifactId>simple-plugin</artifactId>
        <packaging>nar</packaging>
        <version>1.0-SNAPSHOT</version>
        ....
        <build>
                <sourceDirectory>src/main/cpp</sourceDirectory>
                <plugins>
                        <plugin>
                                <groupId>org.freehep</groupId>
                                <artifactId>freehep-nar-plugin</artifactId>
                                <configuration>
                                        <runtime>static</runtime>
                                        <linker>
                                                <name>msvc</name>
                                        </linker>
                                        <libraries>
                                                <library>
                                                        <type>shared</type>
                                                </library>
                                        </libraries>
                                        <cpp>
                                                <defines>
                                                        
<define>SIMPLEPROVIDER_EXPORTS</define>
                                                </defines>
                                                <optimize>speed</optimize>
                                        </cpp>
                                </configuration>
                        </plugin>
                </plugins>
        </build>



In that creates the assembly:

        <build>
                <plugins>
                        <plugin>
                                <artifactId>maven-assembly-plugin</artifactId>
                                ...
                        </plugin>
                        <plugin>
                                <groupId>org.freehep</groupId>
                                <artifactId>freehep-nar-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <goals>
                                                        
<goal>nar-download</goal>
                                                        <goal>nar-unpack</goal>
                                                        
<goal>nar-assembly</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <classifiers>
                                                
<classifier>x86-Windows-msvc-shared</classifier>
                                        </classifiers>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

        <dependencies>
                <dependency>
                        <groupId>my.group</groupId>
                        <artifactId>simple-plugin</artifactId>
                </dependency>
                ...
        </dependencies>

Hope this helps,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to