Maven无法在jar中找到包。

时间:2023-01-25 22:46:25

I have two projects. Project A has Project B as a dependency in it's pom.

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

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

Project B's pom:

项目B的pom:

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

However, when I attempt to build Project A with Maven (via eclipse using arguments "clean install -X"), I get compilation errors:

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

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

I get package * does not exist errors for literally every package from Project B. I checked the local Maven repo, and the jar is present and inside the jar the compiled files are there. According to the debug output, Project B is successfully added to the classpath when starting to compile Project A.

我得到的包*并不存在从项目b的每个包中都存在的错误。我检查了本地的Maven repo,并且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

So, if Maven is finding Project B, and Project B does have all the classes inside it that it's supposed to, why is it unable to find any of those classes during the compilation phase?

所以,如果Maven找到了B项目,而B项目确实有它所期望的所有类,为什么在编译阶段它不能找到这些类呢?

EDIT: The total output from "clean install -X" on Project A is too big, so this is a larger but still abridged version.

编辑:项目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

5 个解决方案

#1


1  

You have a spelling mistake in the name of your package in project B (my.packge.abc => my.package.abc)

您在项目B (my.packge)中有一个拼写错误。美国广播公司(abc)= > my.package.abc)

#2


1  

did you do a successful "mvn clean install" on project b first?

你在b项目上做了一个成功的“mvn清洁安装”吗?

since project a has a dependency on b that build must go first and the .jar file must be in your local repository.

由于项目a依赖于b,所以构建必须首先进行,.jar文件必须位于本地存储库中。

If it works in eclipse you may just have configured the classpath using eclipse project dependencies which does not influence how maven works.

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

#3


1  

are you doing all of that from the command line? I suggest you to wipe all your artitacts from Maven's cache (the ~/.m2/repository) and re{clean, install} project B then A. Maybe the version in the cache is buggy. Did you try

你是从命令行来执行这些任务的吗?我建议您将所有的artitacts从Maven的缓存(~/.m2/储存库)中删除,然后重新安装B项目。也许缓存中的版本是错误的。你试过

jar tvf [your jar]

to check what's in there?

检查里面有什么?

Maybe you used two maven binaries with two different cache directory. Typically an eclipse maven build (with plugin's maven) and a command line maven build (external binary).

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

#4


0  

Could it be that project B is not build yet (the snapshot version doesn't exist jet), or is out of date.

可能是项目B还没有构建(快照版本不存在jet),或者已经过时了。

so if you first do a clean install on project B and then a clean install on project A it should run as expected.

因此,如果您首先在项目B上做一个干净的安装,然后在项目a上安装一个干净的安装,那么它应该按照预期运行。

I would recommend to make a project with a child projects A and B, then the parent project will build both projects

我建议在一个项目中使用一个子项目a和B,然后父项目将构建两个项目。

#5


0  

This was one of the top hits when I was searching for answers to the exact same scenario. Unfortunately, no answer appeared in the thread.

这是我在寻找相同场景的答案时的热门话题之一。不幸的是,没有答案出现在线程中。

It took a lot of wrangling, but in my case the pom.xml for project B (the dependency) was copying the .java files into the .jar instead of the .class files. Changing the resources section in the pom.xml accordingly gave a clean build and run.

这需要很多的争论,但在我的情况下是pom。用于项目B(依赖项)的xml将.java文件复制到.jar而不是.class文件。更改pom中的资源部分。因此,xml提供了一个干净的构建和运行。

#1


1  

You have a spelling mistake in the name of your package in project B (my.packge.abc => my.package.abc)

您在项目B (my.packge)中有一个拼写错误。美国广播公司(abc)= > my.package.abc)

#2


1  

did you do a successful "mvn clean install" on project b first?

你在b项目上做了一个成功的“mvn清洁安装”吗?

since project a has a dependency on b that build must go first and the .jar file must be in your local repository.

由于项目a依赖于b,所以构建必须首先进行,.jar文件必须位于本地存储库中。

If it works in eclipse you may just have configured the classpath using eclipse project dependencies which does not influence how maven works.

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

#3


1  

are you doing all of that from the command line? I suggest you to wipe all your artitacts from Maven's cache (the ~/.m2/repository) and re{clean, install} project B then A. Maybe the version in the cache is buggy. Did you try

你是从命令行来执行这些任务的吗?我建议您将所有的artitacts从Maven的缓存(~/.m2/储存库)中删除,然后重新安装B项目。也许缓存中的版本是错误的。你试过

jar tvf [your jar]

to check what's in there?

检查里面有什么?

Maybe you used two maven binaries with two different cache directory. Typically an eclipse maven build (with plugin's maven) and a command line maven build (external binary).

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

#4


0  

Could it be that project B is not build yet (the snapshot version doesn't exist jet), or is out of date.

可能是项目B还没有构建(快照版本不存在jet),或者已经过时了。

so if you first do a clean install on project B and then a clean install on project A it should run as expected.

因此,如果您首先在项目B上做一个干净的安装,然后在项目a上安装一个干净的安装,那么它应该按照预期运行。

I would recommend to make a project with a child projects A and B, then the parent project will build both projects

我建议在一个项目中使用一个子项目a和B,然后父项目将构建两个项目。

#5


0  

This was one of the top hits when I was searching for answers to the exact same scenario. Unfortunately, no answer appeared in the thread.

这是我在寻找相同场景的答案时的热门话题之一。不幸的是,没有答案出现在线程中。

It took a lot of wrangling, but in my case the pom.xml for project B (the dependency) was copying the .java files into the .jar instead of the .class files. Changing the resources section in the pom.xml accordingly gave a clean build and run.

这需要很多的争论,但在我的情况下是pom。用于项目B(依赖项)的xml将.java文件复制到.jar而不是.class文件。更改pom中的资源部分。因此,xml提供了一个干净的构建和运行。