maven-nar / nar-maven-plugin

Native ARchive plugin for Maven
https://maven-nar.github.io/
Apache License 2.0
232 stars 160 forks source link

How to use this plugin ? Made me mad really #373

Closed loongs-zhang closed 3 years ago

loongs-zhang commented 3 years ago

use jenkins to build, finally I get this

Could not find artifact com.xxxx.xxxx:nar-maven-plugin-jni-demo:nar:amd64-Linux-gpp-jni:1.0.8-SNAPSHOT in nexus 

the pack pom.xml below

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.xxxx.xxxx</groupId>
        <artifactId>xxxx-parent</artifactId>
        <version>1.0.8-SNAPSHOT</version>
    </parent>

    <artifactId>nar-maven-plugin-jni-demo</artifactId>
    <packaging>nar</packaging>

    <build>
        <defaultGoal>integration-test</defaultGoal>
        <plugins>
            <plugin>
                <groupId>com.github.maven-nar</groupId>
                <artifactId>nar-maven-plugin</artifactId>
                <version>3.10.1</version>
                <extensions>true</extensions>
                <configuration>
                    <c>
                        <debug>true</debug>
                    </c>
                    <libraries>
                        <library>
                            <type>jni</type>
                            <narSystemPackage>it0026.test</narSystemPackage>
                            <linkCPP>false</linkCPP>
                        </library>
                    </libraries>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.scijava</groupId>
            <artifactId>native-lib-loader</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

and reference here:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>mana-pool</artifactId>
        <groupId>com.xxxx.xxxx</groupId>
        <version>1.0.7-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>mana-pool-analyzer</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        ......
        <dependency>
            <groupId>com.xxxx.xxxx</groupId>
            <artifactId>nar-maven-plugin-jni-demo</artifactId>
            <version>1.0.8-SNAPSHOT</version>
            <type>nar</type>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>integration-test</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>so</nonFilteredFileExtension>
                        <nonFilteredFileExtension>dylib</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.github.maven-nar</groupId>
                <artifactId>nar-maven-plugin</artifactId>
                <version>3.10.1</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>nar-download</id>
                        <goals>
                            <goal>nar-download</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>nar-unpack</id>
                        <goals>
                            <goal>nar-unpack</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
loongs-zhang commented 3 years ago

Fine, this is my final solution:https://expresscoding.wordpress.com/2016/05/23/using-native-maven-plugin/