【问题标题】:Maven ,error when build with maven-assembly-pluginMaven,使用 maven-assembly-plugin 构建时出错
【发布时间】:2016-04-26 11:41:18
【问题描述】:

我有一个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>

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

【问题讨论】:

  • 您是否尝试过添加执行部分? make-assemblypackage单一
  • 没什么区别

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


【解决方案1】:

尝试使用它。只有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>

【讨论】:

  • 谢谢你的回答,但我遇到了同样的错误
  • 您在运行应用程序时或构建期间是否出现此错误?
  • 只是在构建过程中,,,,,实际上找不到的包是我创建的包,,,我的意思是它不是外部jar的
  • 如果在构建过程中我认为你有真正的编译错误,你必须先解决它。所以它发生在编译阶段,与程序集打包无关。你还没有达到这个阶段
  • 你的 pom 文件中是否有所有正确的依赖关系?
猜你喜欢
  • 2016-10-13
  • 1970-01-01
  • 2014-09-05
  • 1970-01-01
  • 2013-02-19
  • 2012-03-25
  • 2010-11-28
  • 1970-01-01
  • 2014-03-12
相关资源
最近更新 更多