gpt4 book ai didi

java - Maven 提示 Joda-Time 即使我安装了它

转载 作者:行者123 更新时间:2023-11-30 11:28:05 32 4
gpt4 key购买 nike

因为我想用ActiveAndroidActiveAndroid-Validation我需要使用 Maven(直到昨天我才听说过)。所以我安装了maven,然后尝试安装ActiveAndroid。

我写了一个custom serializer在 ActiveAndroid 中使用 JodaTime并在 ActiveAndroid libs 文件夹中包含一个 JodaTime jar。当我使用 ant 构建项目时,它运行良好。首先使用 Maven downloaded并使用 JodaTime 源文件夹中的 mvn clean install 在 Maven 中安装 JodaTime。看到下面几行就成功了:

[INFO] --- maven-install-plugin:2.4:install (default-install) @ joda-time ---
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/pom.xml to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.pom
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3-javadoc.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3-javadoc.jar
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3-sources.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.603s
[INFO] Finished at: Thu Sep 26 13:00:54 CEST 2013
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------

然后我尝试使用相同的 mvn clean install 从 ActiveAndroid 源文件夹中安装 ActiveAndroid。然而,这导致了以下错误:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.095s
[INFO] Finished at: Thu Sep 26 13:01:08 CEST 2013
[INFO] Final Memory: 13M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project activeandroid: Compilation failure: Compilation failure:
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[3,21] package org.joda.time does not exist
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[22,16] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[7,24] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[19,26] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[27,28] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] -> [Help 1]
[ERROR]
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :activeandroid

有人知道我该如何解决这个问题吗?欢迎所有提示!

==编辑==ActiveAndroid的pom.xml可以找到here .我没有更改任何内容。

最佳答案

如果您的 IDE 没有报错,则表示您的 IDE 可以构建项目。

那么我假设你的 IDE 不依赖 maven 来构建。我会建议 maven 和您的 IE 之间进行更强大的集成。您不应该手动将库添加到您的类路径(在 IDE 中)

您的 POM 缺少依赖项

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>

关于java - Maven 提示 Joda-Time 即使我安装了它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19026744/

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