简体   繁体   English

maven 程序集插件不包括我在内置 jar 中的类

[英]maven assembly plugin does not include my classes inside built jar

Any code referenced below is from the project here下面引用的任何代码都来自这里的项目

For the AWS Lambda, I have been trying to create a jar file based on the maven configuration defined here.对于 AWS Lambda,我一直在尝试根据此处定义的 maven 配置创建一个 jar 文件。

<?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>be.quodlibet</groupId>
<artifactId>HelloLambda</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-core</artifactId>
        <version>1.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.1.0</version>
    </dependency>
</dependencies>
<build>

  <plugins>
  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
        </configuration>
        <executions>
            <execution>
                <id>assemble-all</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
 </plugins>

When I try and build the fat JAR, upload it to AWS Lambda console, I see the error当我尝试构建胖 JAR 并将其上传到 AWS Lambda 控制台时,我看到了错误

The following package be.quodlibet.hellolambda was not added to the jar resulting in a以下包be.quodlibet.hellolambda未添加到 jar 导致

"errorMessage": "Class not found: be.quodlibet.hellolambda.helloHandler",
"errorType": "java.lang.ClassNotFoundException"

正如@khmarbaise 在评论中所说,请确保您运行“mvn clean package”而不是“mvn clean assembly:single”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在assembly-plugin(包含依赖项)jar中包含Maven配置文件名称 - Include Maven profile name in assembly-plugin built (with dependencies) jar 为什么Maven Assembly Plugin不包含带有依赖项的jar中的项目文件? - Why Maven Assembly Plugin does not include my project files in the jar with dependencies ? Maven程序集插件目标“ jar-with-dependencies”不包括子pom的jar文件 - Maven assembly plugin goal 'jar-with-dependencies' does not include a jar file from child pom Eclipse内置jar导出选项vs Maven程序集插件 - Eclipse built-in jar export option vs Maven assembly plugin 从使用kotlin-maven-plugin构建的jar中使用Kotlin类 - Using Kotlin classes from jar built with kotlin-maven-plugin 如何使用maven-assembly-plugin包含package.jar - How to include package.jar with maven-assembly-plugin Maven Assembly Plugin - 包含来自其他模块的类 - Maven Assembly Plugin - Include classes from another module 如何在maven-shade-plugin创建的Jar中包含测试类? - How to include test classes in Jar created by maven-shade-plugin? maven-gae-plugin,如何将我的课程打包为JAR? - maven-gae-plugin, how to package my classes as a JAR? Maven Build Plugin不包括我自己的类 - Maven Build Plugin doesn't include my own classes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM