6

我有两个项目。项目 A 将项目 B 作为其 pom 中的依赖项。

    <dependency>
        <groupId>my.package.abc</groupId>
        <artifactId>abc-common</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>

项目 B 的 pom:

<groupId>my.package.abc</groupId>
<artifactId>abc-common</artifactId>
<version>0.0.1-SNAPSHOT</version>

但是,当我尝试使用 Maven 构建项目 A 时(通过 eclipse 使用参数“clean install -X”),我得到编译错误:

[ERROR] ...\src\main\java\my\package\abc\client\Myclass.java:[3,37] error: package my.package.abc.common.client does not exist

对于来自项目 B 的每个包,我得到包 * 不存在错误。我检查了本地 Maven 存储库,并且 jar 存在并且在 jar 中编译的文件在那里。根据调试输出,在开始编译项目 A 时,项目 B 已成功添加到类路径中。

[DEBUG] Classpath:
...
[DEBUG]  ...\.m2\repository\my\package\abc\abc-common\0.0.1-SNAPSHOT\abc-common-0.0.1-SNAPSHOT.jar

那么,如果 Maven 正在寻找项目 B,并且项目 B 中确实包含它应该找到的所有类,为什么它在编译阶段无法找到这些类中的任何一个?

编辑:项目 A 上“clean install -X”的总输出太大,所以这是一个更大但仍然是删节的版本。

    [INFO] Deleting directory ..\workspace\abc-bci-web\target\classes\my\package
    [INFO] Deleting directory ..\workspace\abc-bci-web\target\classes\my
    [INFO] Deleting directory ..\workspace\abc-bci-web\target\classes\gov
    [INFO] Deleting directory ..\workspace\abc-bci-web\target\classes
    [INFO] Deleting directory ..\workspace\abc-bci-web\target
    [INFO] 
    [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ abc-bci-web ---
    [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3:
    [DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-core:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile
    [DEBUG]       org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile
    [DEBUG]          org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile
    [DEBUG]       org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.6:compile
    [DEBUG]       commons-cli:commons-cli:jar:1.0:compile
    [DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.6:compile
    [DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
    [DEBUG]       classworlds:classworlds:jar:1.1:compile
    [DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-settings:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-model:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-monitor:jar:2.0.6:compile
    [DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
    [DEBUG]       junit:junit:jar:3.8.1:compile
    [DEBUG]    org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
    [DEBUG]    org.apache.maven.shared:maven-filtering:jar:1.0-beta-4:compile
    [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.4:compile
    [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.13:compile
    [DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
    [DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
    [DEBUG]   Imported:  < maven.api
    [DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
    [DEBUG]   Included: org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3
    [DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.6
    [DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7
    [DEBUG]   Included: commons-cli:commons-cli:jar:1.0
    [DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
    [DEBUG]   Included: junit:junit:jar:3.8.1
    [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
    [DEBUG]   Included: org.apache.maven.shared:maven-filtering:jar:1.0-beta-4
    [DEBUG]   Included: org.sonatype.plexus:plexus-build-api:jar:0.0.4
    [DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.13
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-core:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.6
    [DEBUG]   Excluded: classworlds:classworlds:jar:1.1
    [DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-monitor:jar:2.0.6
    [DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
    [DEBUG] Configuring mojo org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3, parent: sun.misc.Launcher$AppClassLoader@3d882ea9]
    [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources' with basic configurator -->
    [DEBUG]   (f) buildFilters = []
    [DEBUG]   (f) encoding = UTF-8
    [DEBUG]   (f) escapeWindowsPaths = true
    [DEBUG]   (s) includeEmptyDirs = false
    [DEBUG]   (s) outputDirectory = ..\workspace\abc-bci-web\target\classes
    [DEBUG]   (s) overwrite = false
    [DEBUG]   (f) project = MavenProject: my.package.abc:abc-bci-web:0.0.1-SNAPSHOT @ ..\workspace\abc-bci-web\pom.xml
    [DEBUG]   (s) resources = [Resource {targetPath: null, filtering: true, FileSet {directory: ..\workspace\abc-bci-web\src\main\resources, PatternSet [includes: {**/*}, excludes: {}]}}]
    [DEBUG]   (f) session = org.apache.maven.execution.MavenSession@71f15b67
    [DEBUG]   (f) useBuildFilters = true
    [DEBUG]   (s) useDefaultDelimiters = true
    [DEBUG] -- end configuration --
    ...
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [DEBUG] resource with targetPath null
    directory ..\workspace\abc-bci-web\src\main\resources
    excludes []
    includes [**/*]
    [DEBUG] ignoreDelta true
    [INFO] Copying 5 resources
    [DEBUG] file applicationContext.xml has a filtered file extension
    [DEBUG] filering ..\workspace\abc-bci-web\src\main\resources\my\package\abc\server\config\applicationContext.xml to ..\workspace\abc-bci-web\target\classes\my\package\abc\server\config\applicationContext.xml
    [DEBUG] file log4j-at-info.xml has a filtered file extension
    [DEBUG] filering ..\workspace\abc-bci-web\src\main\resources\log4j-at-info.xml to ..\workspace\abc-bci-web\target\classes\log4j-at-info.xml
    [DEBUG] file log4j-debug.xml has a filtered file extension
    [DEBUG] filering ..\workspace\abc-bci-web\src\main\resources\log4j-debug.xml to ..\workspace\abc-bci-web\target\classes\log4j-debug.xml
    [DEBUG] file log4j-info.xml has a filtered file extension
    [DEBUG] filering ..\workspace\abc-bci-web\src\main\resources\log4j-info.xml to ..\workspace\abc-bci-web\target\classes\log4j-info.xml
    [DEBUG] file SystemSettings.properties has a filtered file extension
    [DEBUG] filering ..\workspace\abc-bci-web\src\main\resources\SystemSettings.properties to ..\workspace\abc-bci-web\target\classes\SystemSettings.properties
    [INFO] 
    [INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ abc-bci-web ---
    [DEBUG] org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.1:
    [DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
    [DEBUG]       junit:junit:jar:3.8.1:compile
    [DEBUG]       classworlds:classworlds:jar:1.1-alpha-2:compile
    [DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
    [DEBUG]    org.apache.maven:maven-core:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-settings:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile
    [DEBUG]       org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile
    [DEBUG]          org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile
    [DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-model:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-project:jar:2.0.6:compile
    [DEBUG]          org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
    [DEBUG]       commons-cli:commons-cli:jar:1.0:compile
    [DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.6:compile
    [DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
    [DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
    [DEBUG]       org.apache.maven:maven-monitor:jar:2.0.6:compile
    [DEBUG]    org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
    [DEBUG]    org.codehaus.plexus:plexus-compiler-api:jar:1.8:compile
    [DEBUG]    org.apache.maven:maven-toolchain:jar:1.0:compile
    [DEBUG]    org.codehaus.plexus:plexus-compiler-manager:jar:1.8:compile
    [DEBUG]    org.codehaus.plexus:plexus-compiler-javac:jar:1.8:runtime
    [DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.1
    [DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.1
    [DEBUG]   Imported:  < maven.api
    [DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.1
    [DEBUG]   Included: org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.1
    [DEBUG]   Included: junit:junit:jar:3.8.1
    [DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.6
    [DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7
    [DEBUG]   Included: commons-cli:commons-cli:jar:1.0
    [DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
    [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
    [DEBUG]   Included: org.codehaus.plexus:plexus-compiler-api:jar:1.8
    [DEBUG]   Included: org.codehaus.plexus:plexus-compiler-manager:jar:1.8
    [DEBUG]   Included: org.codehaus.plexus:plexus-compiler-javac:jar:1.8
    [DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
    [DEBUG]   Excluded: classworlds:classworlds:jar:1.1-alpha-2
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-core:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-monitor:jar:2.0.6
    [DEBUG]   Excluded: org.apache.maven:maven-toolchain:jar:1.0
    [DEBUG] Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@3d882ea9]
    [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile' with basic configurator -->
    [DEBUG]   (f) basedir = ..\workspace\abc-bci-web
    [DEBUG]   (f) buildDirectory = ..\workspace\abc-bci-web\target
    [DEBUG]   (f) classpathElements = [..\workspace\abc-bci-web\target\classes, ..\.m2\repository\my\dps\frameworks\dps-gwt-framework\2.13-SNAPSHOT\dps-gwt-framework-2.13-SNAPSHOT.jar, ..\.m2\repository\com\google\gwt\gwt-user\2.4.0\gwt-user-2.4.0.jar, ..\.m2\repository\com\allen-sauer\gwt\log\gwt-log\3.1.8\gwt-log-3.1.8.jar, ..\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar, ..\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar, 
...
..\.m2\repository\my\package\abc\abc-domain\0.0.1-SNAPSHOT\abc-domain-0.0.1-SNAPSHOT.jar, ..\.m2\repository\my\package\abc\abc-common\0.0.1-SNAPSHOT\abc-common-0.0.1-SNAPSHOT.jar]
    [DEBUG]   (f) compileSourceRoots = [..\workspace\abc-bci-web\src\main\java]
    [DEBUG]   (f) compilerArgument = -implicit:none
    [DEBUG]   (f) compilerId = javac
    [DEBUG]   (f) debug = true
    [DEBUG]   (f) encoding = UTF-8
    [DEBUG]   (f) failOnError = true
    [DEBUG]   (f) fork = false
    [DEBUG]   (f) generatedSourcesDirectory = ..\workspace\abc-bci-web\target\generated-sources\annotations
    [DEBUG]   (f) optimize = false
    [DEBUG]   (f) outputDirectory = ..\workspace\abc-bci-web\target\classes
    [DEBUG]   (f) outputFileName = abc-bci-web
    [DEBUG]   (f) projectArtifact = my.package.abc:abc-bci-web:war:0.0.1-SNAPSHOT
    [DEBUG]   (f) session = org.apache.maven.execution.MavenSession@71f15b67
    [DEBUG]   (f) showDeprecation = false
    [DEBUG]   (f) showWarnings = false
    [DEBUG]   (f) source = 1.6
    [DEBUG]   (f) staleMillis = 0
    [DEBUG]   (f) target = 1.6
    [DEBUG]   (f) verbose = false
    [DEBUG] -- end configuration --
    [DEBUG] Using compiler 'javac'.
    [DEBUG] Source directories: [..\workspace\abc-bci-web\src\main\java]
    [DEBUG] Classpath: [..\workspace\abc-bci-web\target\classes
     ..\.m2\repository\my\dps\frameworks\dps-gwt-framework\2.13-SNAPSHOT\dps-gwt-framework-2.13-SNAPSHOT.jar
     ..\.m2\repository\com\google\gwt\gwt-user\2.4.0\gwt-user-2.4.0.jar
     ..\.m2\repository\com\allen-sauer\gwt\log\gwt-log\3.1.8\gwt-log-3.1.8.jar
     ..\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar
     ..\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar
     ...
     ..\.m2\repository\my\package\abc\abc-domain\0.0.1-SNAPSHOT\abc-domain-0.0.1-SNAPSHOT.jar
     ..\.m2\repository\my\package\abc\abc-common\0.0.1-SNAPSHOT\abc-common-0.0.1-SNAPSHOT.jar]
    [DEBUG] Output directory: ..\workspace\abc-bci-web\target\classes
    [DEBUG] Classpath:
    [DEBUG]  ..\workspace\abc-bci-web\target\classes
    [DEBUG]  ..\.m2\repository\my\dps\frameworks\dps-gwt-framework\2.13-SNAPSHOT\dps-gwt-framework-2.13-SNAPSHOT.jar
    [DEBUG]  ..\.m2\repository\com\google\gwt\gwt-user\2.4.0\gwt-user-2.4.0.jar
    [DEBUG]  ..\.m2\repository\com\allen-sauer\gwt\log\gwt-log\3.1.8\gwt-log-3.1.8.jar
    [DEBUG]  ..\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar
    [DEBUG]  ..\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar
    ...
    [DEBUG]  ..\.m2\repository\my\package\abc\abc-domain\0.0.1-SNAPSHOT\abc-domain-0.0.1-SNAPSHOT.jar
    [DEBUG]  ..\.m2\repository\my\package\abc\abc-common\0.0.1-SNAPSHOT\abc-common-0.0.1-SNAPSHOT.jar
    [DEBUG] Source roots:
    [DEBUG]  ..\workspace\abc-bci-web\src\main\java
    [DEBUG] Command line options:
    [DEBUG] -d ..\workspace\abc-bci-web\target\classes -classpath ..\workspace\abc-bci-web\target\classes;..\.m2\repository\my\dps\frameworks\dps-gwt-framework\2.13-SNAPSHOT\dps-gwt-framework-2.13-SNAPSHOT.jar;..\.m2\repository\com\google\gwt\gwt-user\2.4.0\gwt-user-2.4.0.jar;..\.m2\repository\com\allen-sauer\gwt\log\gwt-log\3.1.8\gwt-log-3.1.8.jar;..\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;..\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar;..\.m2\repository\my\package\abc\abc-domain\0.0.1-SNAPSHOT\abc-domain-0.0.1-SNAPSHOT.jar;..\.m2\repository\my\package\abc\abc-common\0.0.1-SNAPSHOT\abc-common-0.0.1-SNAPSHOT.jar; -sourcepath ..\workspace\abc-bci-web\src\main\java; C:...\src\main\java\my\packge\abc\client\AbcBciWeb.java C:...\src\main\java\my\packge\abc\client\review\ch\ChDetailEntryPanel.java C:...\src\main\java\my\packge\abc\client\review\sww\SwwDetailCell.java C:...\src\main\java\my\packge\abc\client\AbcMainPanel.java C:...\src\main\java\my\packge\abc\client\review\sww\SwwDetailEntryPanel.java C:...\src\main\java\my\packge\abc\client\review\sww\SwwReviewTab.java C:...\src\main\java\my\packge\abc\client\review\ReviewComposite.java C:...\src\main\java\my\packge\abc\client\review\juvenile\JuvReviewTab.java C:...\src\main\java\my\packge\abc\client\review\ch\ChDetailCell.java C:...\src\main\java\my\packge\abc\client\review\sww\SwwNameList.java C:...\src\main\java\my\packge\abc\client\AbcMenuPanel.java C:...\src\main\java\my\packge\abc\client\review\events\NameSelectionChangeEvent.java C:...\src\main\java\my\packge\abc\client\review\sww\SwwDetailCellList.java C:...\src\main\java\my\packge\abc\client\review\ReviewTabController.java C:...\src\main\java\my\packge\abc\client\review\ReviewMenuPanel.java C:...\src\main\java\my\packge\abc\client\review\ch\ChReviewTab.java C:...\src\main\java\my\packge\abc\client\review\ch\ChNameList.java C:...\src\main\java\my\packge\abc\client\review\ncic\NcicReviewTab.java C:...\src\main\java\my\packge\abc\client\review\fbi\FbiReviewTab.java C:...\src\main\java\my\packge\abc\client\review\events\NameSelectionChangeHandler.java C:...\src\main\java\my\packge\abc\client\review\ch\ChDetailCellList.java C:...\src\main\java\my\packge\abc\client\review\ReviewTabHandler.java -s ..\workspace\abc-bci-web\target\generated-sources\annotations -g -nowarn -target 1.6 -source 1.6 -encoding UTF-8 -implicit:none
    [INFO] Compiling 22 source files to ..\workspace\abc-bci-web\target\classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR : 
    [INFO] -------------------------------------------------------------
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[3,37] error: package my.package.abc.common.client does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[4,52] error: package my.package.abc.common.client.view.incidents does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[5,37] error: package my.package.abc.common.shared does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[6,51] error: package my.package.abc.common.shared.authorization does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[17,31] error: cannot find symbol

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[3,44] error: package my.package.abc.common.client.events does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[4,44] error: package my.package.abc.common.client.events does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[5,44] error: package my.package.abc.common.client.events does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[6,44] error: package my.package.abc.common.client.events does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[7,49] error: package my.package.abc.common.client.view.header does not exist

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[17,47] error: type BaseMainPanel does not take parameters

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[17,75] error: cannot find symbol

    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[17,103] error: cannot find symbol
    ...

    [INFO] 100 errors 
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 32.497s
    [INFO] Finished at: Tue Jun 19 13:20:24 MDT 2012
    [INFO] Final Memory: 21M/123M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project abc-bci-web: Compilation failure: Compilation failure:
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[3,37] error: package my.package.abc.common.client does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[4,52] error: package my.package.abc.common.client.view.incidents does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[5,37] error: package my.package.abc.common.shared does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[6,51] error: package my.package.abc.common.shared.authorization does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcBciWeb.java:[17,31] error: cannot find symbol
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[3,44] error: package my.package.abc.common.client.events does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[4,44] error: package my.package.abc.common.client.events does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[5,44] error: package my.package.abc.common.client.events does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[6,44] error: package my.package.abc.common.client.events does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[7,49] error: package my.package.abc.common.client.view.header does not exist
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[17,47] error: type BaseMainPanel does not take parameters
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[17,75] error: cannot find symbol
    [ERROR] 
    [ERROR] ...\src\main\java\my\packge\abc\client\AbcMainPanel.java:[17,103] error: cannot find symbol
    ...
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project abc-bci-web: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
    [ERROR] 
    [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
4

5 回答 5

1

您在项目 B 中的包名称有拼写错误 (my.packge.abc => my.package.abc)

于 2012-06-20T05:09:35.193 回答
1

您是否首先对项目 b 进行了成功的“mvn clean install”?

由于项目 a 依赖于 b ,因此构建必须首先进行,并且 .jar 文件必须在您的本地存储库中。

如果它在 eclipse 中工作,您可能只是使用 eclipse 项目依赖项配置了类路径,这不会影响 maven 的工作方式。

于 2012-06-28T15:45:21.403 回答
1

你是从命令行做所有这些吗?我建议你从 Maven 的缓存(~/.m2/repository)中擦除所有的工件,然后重新{clean,安装}项目 B,然后是 A。也许缓存中的版本有问题。你试过了吗

jar tvf [your jar]

检查里面有什么?

也许您使用了两个具有两个不同缓存目录的 Maven 二进制文件。通常是 eclipse maven 构建(带有插件的 maven)和命令行 maven 构建(外部二进制文件)。

于 2012-06-29T09:02:26.653 回答
0

当我在寻找完全相同的场景的答案时,这是最热门的作品之一。不幸的是,线程中没有答案。

这花费了很多时间,但在我的情况下,项目 B(依赖项)的 pom.xml 将 .java 文件复制到 .jar 而不是 .class 文件中。相应地更改 pom.xml 中的资源部分可以进行干净的构建和运行。

于 2012-12-31T21:33:55.840 回答
0

可能是项目 B 尚未构建(快照版本不存在 jet),或者已过时。

因此,如果您首先在项目 B 上进行全新安装,然后在项目 A 上进行全新安装,它应该按预期运行。

我建议使用子项目 A 和 B 创建一个项目,然后父项目将构建这两个项目

于 2012-06-29T09:07:16.393 回答