我想在svn中签入代码并且不想保存二进制文件,所以我删除了由maven自动创建的Target
文件夹。问题是我做到这一点,maven构建失败了。
以下是我所尝试的内容:
mvn clean install
mvn clean compile -DskipTests=true install
有趣的是,eclipse不再为该项目显示标题为Maven Dependencies
的子节点,因为其他项目工作正常。我根本没有修改过POM文件。
此处阻止了Pastebin,因此在此处附加构建输出。
任何帮助将不胜感激!
[INFO] 23 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Extractors ........................................ SUCCESS [0.125s]
[INFO] GenericExtractor .................................. FAILURE [0.687s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.968s
[INFO] Finished at: Fri Aug 10 15:36:44 EDT 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project GenericExtractor: Compilation failure: Compilation failure:
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\DelimitedExtractor.java:[8,23] package org.apache.log4j does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[11,23] package org.apache.log4j does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[13,37] package com.ABCInc.ef.common.core.caching does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[14,37] package com.ABCInc.ef.common.core.caching does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\DelimitedExtractor.java:[17,22] cannot find symbol
[ERROR] symbol : class Logger
[ERROR] location: class com.ABCInc.ef.extractors.core.DelimitedExtractor<TKey,TValue>
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\FieldInfo.java:[5,31] package org.springframework.util does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[22,22] cannot find symbol
[ERROR] symbol : class Logger
[ERROR] location: class com.ABCInc.ef.extractors.core.CoreExtractor<TKey,TValue>
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[6,23] package org.apache.log4j does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[7,34] package org.springframework.context does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[8,42] package org.springframework.context.support does not exist
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[19,22] cannot find symbol
[ERROR] symbol : class Logger
[ERROR] location: class com.ABCInc.ef.extractors.application.Launcher
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[22,38] cannot find symbol
[ERROR] symbol : variable Logger
[ERROR] location: class com.ABCInc.ef.extractors.core.CoreExtractor<TKey,TValue>
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[148,3] cannot find symbol
[ERROR] symbol : class ICacheManager
[ERROR] location: class com.ABCInc.ef.extractors.core.CoreExtractor<TKey,TValue>
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\CoreExtractor.java:[148,32] cannot find symbol
[ERROR] symbol : variable CacheManagerFactory
[ERROR] location: class com.ABCInc.ef.extractors.core.CoreExtractor<TKey,TValue>
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\DelimitedExtractor.java:[17,38] cannot find symbol
[ERROR] symbol : variable Logger
[ERROR] location: class com.ABCInc.ef.extractors.core.DelimitedExtractor<TKey,TValue>
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\FieldInfo.java:[15,15] cannot find symbol
[ERROR] symbol : variable ReflectionUtils
[ERROR] location: class com.ABCInc.ef.extractors.core.FieldInfo
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\FieldInfo.java:[16,2] cannot find symbol
[ERROR] symbol : variable ReflectionUtils
[ERROR] location: class com.ABCInc.ef.extractors.core.FieldInfo
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\FieldInfo.java:[49,15] cannot find symbol
[ERROR] symbol : variable ReflectionUtils
[ERROR] location: class com.ABCInc.ef.extractors.core.FieldInfo
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\FieldInfo.java:[55,15] cannot find symbol
[ERROR] symbol : variable ReflectionUtils
[ERROR] location: class com.ABCInc.ef.extractors.core.FieldInfo
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\core\FieldInfo.java:[78,15] cannot find symbol
[ERROR] symbol : variable ReflectionUtils
[ERROR] location: class com.ABCInc.ef.extractors.core.FieldInfo
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[19,38] cannot find symbol
[ERROR] symbol : variable Logger
[ERROR] location: class com.ABCInc.ef.extractors.application.Launcher
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[28,2] cannot find symbol
[ERROR] symbol : class ApplicationContext
[ERROR] location: class com.ABCInc.ef.extractors.application.Launcher
[ERROR] \ABCInc\DEV\GemFireCode\src\java\Extractors\GenericExtractor\src\main\java\com\ABCInc\ef\extractors\application\Launcher.java:[28,30] cannot find symbol
[ERROR] symbol : class ClassPathXmlApplicationContext
[ERROR] location: class com.ABCInc.ef.extractors.application.Launcher
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project GenericExtractor: 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:537)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]
[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 :GenericExtractor
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ABCInc.ef.extractors</groupId>
<artifactId>Extractors</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Extractors</name>
<url>http://maven.apache.org</url>
<modules>
<module>GenericExtractor</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.2.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
答案 0 :(得分:2)
看起来您只在POM中声明了<dependencyManagement>
部分。为了将依赖项实际添加到编译时类路径中,您还需要在POM根目录下的<dependencies>
块中声明它们。
答案 1 :(得分:1)
在pom.xml
中,您应该在顶级<dependencies>
元素中指定依赖项,而不是<dependencyManagement>
元素中的依赖项,如下所示:
<project>
...
<url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
</dependencies>
...
</project>