gpt4 book ai didi

java maven编译错误: cannot find symbol

转载 作者:太空宇宙 更新时间:2023-11-04 09:56:49 25 4
gpt4 key购买 nike

java maven 编译错误:找不到符号我正在使用 eclipse 从远程 Linux 机器构建 java maven 项目。我使用 Eclipse Remote System Explorer (RSE) 连接到项目。当我想干净安装项目时,maven 似乎找不到我的一些类。

这是错误,我是项目 POM 文件。

错误:

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rule_miner ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\pita\eclipse-workspace\RemoteSystemsTempFiles\192.168.45.102\home\ubuntu\newRR\rudik\target classes

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/pita/eclipse-workspace/RemoteSystemsTempFiles/192.168.45.102/home/ubuntu/newRR/rudik/src/main/java/asu/edu/rule_miner/rudik/model/horn_rule/HornRule.java:[13,32] cannot
find symbol
symbol: class RuleMinerException
location: package asu.edu.rule_miner.rudik
[ERROR] /C:/Users/pita/eclipse-workspace/RemoteSystemsTempFiles/192.168.45.102/home/ubuntu/newRR/rudik/src/main/java/asu/edu/rule_miner/rudik/model/horn_rule/HornRule.java:[14,46] package
asu.edu.rule_miner.rudik.configuration does not exist
....
....
....
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

POM:

<build>

<!-- Plugin management -->
<pluginManagement>

<plugins>
<!-- Configure the SSH/SCP connector -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>

</plugins>

</pluginManagement>

<!-- Plugins used to modify build-lifecycle behaviour -->
<plugins>

<!-- Generate and install source, bound to verify phase, it is active
in case of install and deploy -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Generate javadoc, bound to deploy phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Forces the compiler to 1.8 (source and target) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<!-- Site generation plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>

<reportPlugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<reportSets>
<reportSet>
<reports>
<report>dependencies</report>
<report>project-team</report>
<report>license</report>
</reports>
</reportSet>
</reportSets>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>

<reportSets>
<reportSet>
<id>default</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</reportPlugins>
</configuration>
</plugin>

</plugins>
</build>

最佳答案

看起来像

asu.edu.rule_miner.rudik.configuration

不在您的类路径中。将依赖项添加到您的 pom 或检查类是否可访问。

关于java maven编译错误: cannot find symbol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54040606/

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