使用nar-maven-plugin的Spring-boot-maven-plugin重新打包目标错误 [英] Spring-boot-maven-plugin repackage goal error using nar-maven-plugin

查看:99
本文介绍了使用nar-maven-plugin的Spring-boot-maven-plugin重新打包目标错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的spring boot项目中使用了nar-maven-plugin,开发时一切正常,但是当我运行maven package项目时,编译进行得很好,直到最后一步抛出错误:

I'm using nar-maven-plugin with my spring boot project, everything goes well when developing but when i run maven package the project the compilation goes well until the final step where throws me the error:

[INFO] 
[INFO] --- nar-maven-plugin:3.2.0:nar-test (default-nar-test) @ customertracker ---
[INFO] Preparing Nar dependencies
[INFO] Unpacking 0 dependencies to /home/diego/Development/Web/Spring/CustomerTracker/target/test-nar
[INFO] 
[INFO] --- nar-maven-plugin:3.2.0:nar-prepare-package (default-nar-prepare-package) @ customertracker ---
[INFO] 
[INFO] --- nar-maven-plugin:3.2.0:nar-package (default-nar-package) @ customertracker ---
[INFO] Building zip: /home/diego/Development/Web/Spring/CustomerTracker/target/customertracker-0.0.1-SNAPSHOT-amd64-Linux-gpp-jni.nar
[INFO] 
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ customertracker ---
[INFO] Building jar: /home/diego/Development/Web/Spring/CustomerTracker/target/customertracker-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.2.3.RELEASE:repackage (default) @ customertracker ---
[INFO] Attaching archive: /home/diego/Development/Web/Spring/CustomerTracker/target/customer-tracker-app.nar, with classifier: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.190 s
[INFO] Finished at: 2015-05-20T09:41:16-05:00
[INFO] Final Memory: 32M/401M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage (default) on project customertracker: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: For artifact {com.housingelectronics:customertracker:0.0.1-SNAPSHOT:nar}: An attached artifact must have a different ID than its corresponding main artifact. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

所以我尝试更改spring-boot-maven-pluginnar-maven-plugin输出属性中的fileName属性,但不起作用

so i try to change the fileName property in spring-boot-maven-plugin and in my nar-maven-plugin output property, but not works

这是我的行家简化版:

<?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>

    <groupId>com.housingelectronics</groupId>
    <artifactId>customertracker</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>nar</packaging> <-- changing this to jar works but the applications does not find the .so library on runtime -->

    <name>CustomerTracker</name>
    <description>Customer Tracker</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.3.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <start-class>customertracker.CustomerTrackerApplication</start-class>
        <java.version>1.7</java.version>
    </properties>

    <dependencies>
        ...
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>springloaded</artifactId>
                        <version>1.2.1.RELEASE</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <finalName>customer-tracker-app</finalName>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.maven-nar</groupId>
                <artifactId>nar-maven-plugin</artifactId>
                <version>3.2.0</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <configuration>
                        <output>customer-tracker-nar-generated</output>
                            <cpp>
                                <sourceDirectory>src/main/c++/udevLaserScannerDriverJNI/</sourceDirectory>
                                <includes>
                                    <include>laserscannerlistener.cpp</include>
                                    <include>utils.cpp</include>
                                    <include>netlink/**/*.cc</include>
                                </includes>
                            </cpp>
                            <c>
                                <excludes>
                                    <exclude>**/node_modules/**/*.c</exclude>
                                </excludes>
                            </c>
                            <java>
                                <include>true</include>
                            </java>
                            <javah>
                                <jniDirectory>src/main/c++/udevLaserScannerDriverJNI/</jniDirectory>
                            </javah>
                            <libraries>
                                <library>
                                    <type>jni</type>
                                    <narSystemPackage>customertracker.devices.udev</narSystemPackage>
                                </library>
                            </libraries>
                        </configuration>
                        <!-- <phase>generate-sources</phase> -->
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

感谢您的帮助.

推荐答案

我找到了解决方案,我要做的是在spring-boot-maven-plugin中使用分类器选项代替fileName,它起作用了,这对我产生了作用两个nar文件,一个使用spring-boot应用程序,另一个使用.so库,现在的问题是使用它们运行应用程序,但是此问题与该线程无关.

i found the solution, what i do is to use classifier option instead of fileName in the spring-boot-maven-plugin and it works, this produces to me two nar files, one with the spring-boot application and the other with the .so library, now the problem is use them for run the application but this problem is independent of this thread.

这篇关于使用nar-maven-plugin的Spring-boot-maven-plugin重新打包目标错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆