Intellij Java Maven Gson导入不';t工作-包不';不存在
我想使用com.google上的gson库,并尝试通过pom、模块Maven导入等将其添加到我的Maven项目中,但Intellij告诉我,即使它显示在我的外部库中,该包也不存在。我试着重新加载,重新启动,删除它,使查奇无效等等,没有任何帮助,有人能帮忙吗Intellij Java Maven Gson导入不';t工作-包不';不存在,java,maven,gson,Java,Maven,Gson,我想使用com.google上的gson库,并尝试通过pom、模块Maven导入等将其添加到我的Maven项目中,但Intellij告诉我,即使它显示在我的外部库中,该包也不存在。我试着重新加载,重新启动,删除它,使查奇无效等等,没有任何帮助,有人能帮忙吗 import com.google.gson 以及具体的错误代码: Error:(9, 18) java: package com.google does not exist My.pom文件: <?xml version=&
import com.google.gson
以及具体的错误代码:
Error:(9, 18) java: package com.google does not exist
My.pom文件:
<?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>org.Avalon</groupId>
<artifactId>Battlesheet</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Avalon</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.14</maven.compiler.source>
<maven.compiler.target>1.14</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15-ea+6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>assembly.Launcher</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>assembly.Launcher</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>
4.0.0
org.Avalon
战场
1.0-快照
阿瓦隆
UTF-8
1.14
1.14
org.openjfx
javafx控件
13
org.openjfx
javafx-fxml
15 ea+6
org.apache.maven.plugins
maven编译器插件
3.8.1
org.apache.maven.plugins
maven汇编插件
3.3.0
com.google.code.gson
格森
2.8.1
org.openjfx
javafxmaven插件
0.0.4
装配式发射器
maven汇编插件
组装
包裹
单一的
真的
装配式发射器
带有依赖项的jar
导入com.google.gson时出错;
它应该被导入com.google.gson.*或导入com.google.gson.gson所取代,如果这没有帮助,请尝试通过Maven工具()重新导入依赖项。
希望这会有所帮助。导入com.google.gson时出错; 它应该被导入com.google.gson.*或导入com.google.gson.gson所取代,如果这没有帮助,请尝试通过Maven工具()重新导入依赖项。
希望这会有所帮助。转到文件->项目结构单击侧面的“库”选项卡。您可以添加或删除任何库。转到文件->项目结构单击侧面的库选项卡。您可以添加或删除任何库。这实际上并不完全正确,因为我必须将gson添加到module-info.java中,但在我更改导入后,Intellij向我提供了该工具提示,最终它可以正常工作。非常感谢。它实际上并不完全正确,因为我必须将gson添加到module-info.java中,但在我更改了导入后,Intellij为我提供了工具提示,最终它成功了。非常感谢。