gpt4 book ai didi

java.lang.NoClassDefFoundError : Failed to link net/glxn/qrgen/javase/QRCode

转载 作者:行者123 更新时间:2023-12-02 09:38:21 25 4
gpt4 key购买 nike

java.lang.NoClassDefFoundError: Failed to link net/glxn/qrgen/javase/QRCode

当我在 .pom 文件中添加此代码时,出现上述错误

<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>net.glxn.qrgen:javase</include>
<include>org.json:json</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</build>

我必须添加 maven-shade-plugin 以添加对第 3 方插件的支持。

有什么想法为什么我会收到此错误吗?

更新pom.xml


<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/maven-v4_0_0.xsd">
<parent>
<artifactId>keycloak-examples-providers-parent</artifactId>
<groupId>org.keycloak</groupId>
<version>4.5.0.Final</version>
</parent>

<name>HyperSign Authenticator</name>
<description/>
<modelVersion>4.0.0</modelVersion>

<artifactId>HyperSignAuth</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>net.glxn.qrgen</groupId>
<artifactId>javase</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>java-dotenv</artifactId>
<version>5.1.1</version>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20080701</version>
</dependency>
</dependencies>

<build>
<finalName>HyperSignAuth</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>net.glxn.qrgen:javase</include>
<include>org.json:json</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

最佳答案

尝试添加依赖项:

https://mvnrepository.com/artifact/net.glxn/qrgen/1.4

<!-- https://mvnrepository.com/artifact/net.glxn/qrgen -->
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>

关于java.lang.NoClassDefFoundError : Failed to link net/glxn/qrgen/javase/QRCode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57317094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com