eclipse下建立的java maven项目,

copy一段别人的pom的dependency到本项目pom,编译报错如下:


[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.179 s
[INFO] Finished at: 2015-05-22T10:21:47+08:00
[INFO] Final Memory: 19M/158M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spring-batch-admin-sample: Compilation failure: Compilation failure:
[ERROR] /D:/Workspace/spring-batch-admin-sample/src/main/java/com/lz/act/batch/support/JobTasklet.java:[7,17] D:\Workspace\spring-batch-admin-sample\src\main\java\com\lz\act\batch\support\JobTasklet.java:7: 软件包 org.slf4j 不存在
[ERROR] /D:/Workspace/spring-batch-admin-sample/src/main/java/com/lz/act/batch/support/JobTasklet.java:[8,17] D:\Workspace\spring-batch-admin-sample\src\main\java\com\lz\act\batch\support\JobTasklet.java:8: 软件包 org.slf4j 不存在
[ERROR] /D:/Workspace/spring-batch-admin-sample/src/main/java/com/lz/act/batch/support/JobTasklet.java:[34,30] D:\Workspace\spring-batch-admin-sample\src\main\java\com\lz\act\batch\support\JobTasklet.java:34: 找不到符号
[ERROR] 符号: 类 Logger
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spring-batch-admin-sample: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 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


检查maven library,jar包是有的,估计是依赖问题。

由于新建的project有parent ,再看parent pom,发现也引用了org.slf4j 。

解决办法:



1、去掉dependency的runtime,或改成compile试试

<dependency>

更多相关文章

  1. Java区分大小写字母数字和符号

随机推荐

  1. relative相关属性
  2. android调用系统发短信界面功能
  3. ubuntu共享文件夹设置
  4. Drawable Mutations(Android(安卓)Drawab
  5. 【建议收藏】2020年中高级Android大厂面
  6. android学习资料
  7. Android 自动滚动的GridView
  8. android studio 报编码 GBK 的不可映射字
  9. Android APK安装失败,共享用户不兼容 INST
  10. android 状态栏透明,源码修改教程