Maven,使用maven-assembly-plugin构建时出错

时间:2016-04-26 11:41:19

标签: java eclipse maven jar maven-assembly-plugin

我有一个maven项目,我想创建一个包含所有依赖项的.jar

我正在使用maven-assembly-plugin

Maven build ...与goal clean package assembly:single我收到错误,如

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] C:\integ\src\main\java\com\woo\bfi\la\ss\batchIntegrator\BatchRunner.java: [11,54] error: package com.ss.ff.ll.dd.bigDataAccessManager does not exist 

它说我在类BatchRunner中导入的包含不存在

但我可以成功运行该应用程序

pom.xml中的插件:

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.test.IntegrationTest</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>

我知道也许没有足够的信息来解决这个问题,但我希望有人遇到同样的问题并解决它

1 个答案:

答案 0 :(得分:0)

尝试使用它。仅mvn clean package

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>

    <configuration>
        <finalName>testXXX</finalName>
        <archive>
            <manifest>
                <mainClass>com.test.IntegrationTest</mainClass>
            </manifest>
        </archive>

        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>

        <appendAssemblyId>false</appendAssemblyId>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>