【问题标题】:Maven Install using WAS7使用 WAS7 安装 Maven
【发布时间】:2014-03-24 13:26:27
【问题描述】:

注意:我使用的是 Maven 3+,请参阅 cmets。

我正在尝试使用 Maven 和 WAS7 编译一个项目,但不幸的是似乎收到以下错误:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[ERROR] Error executing Maven.
[ERROR] com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, java.lang.TypeNotPresentException: Type javax.enterprise.inject.Typed not present
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.sonatype.plexus.components.cipher.PlexusCipher
  while locating org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.sonatype.plexus.components.sec.dispatcher.SecDispatcher annotated with @com.google.inject.name.Named(value=maven)
  while locating org.apache.maven.settings.crypto.DefaultSettingsDecrypter
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.settings.crypto.SettingsDecrypter
  while locating org.apache.maven.repository.legacy.LegacyRepositorySystem
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.repository.RepositorySystem
  while locating org.apache.maven.project.DefaultProjectBuildingHelper
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.project.ProjectBuildingHelper
  while locating org.apache.maven.project.DefaultProjectBuilder
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.project.ProjectBuilder
  while locating org.apache.maven.DefaultMaven
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.Maven

1 error
      role: org.apache.maven.Maven
  roleHint: 
[ERROR] Caused by: Guice provision errors:

1) Error in custom provider, java.lang.TypeNotPresentException: Type javax.enterprise.inject.Typed not present
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.sonatype.plexus.components.cipher.PlexusCipher
  while locating org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.sonatype.plexus.components.sec.dispatcher.SecDispatcher annotated with @com.google.inject.name.Named(value=maven)
  while locating org.apache.maven.settings.crypto.DefaultSettingsDecrypter
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.settings.crypto.SettingsDecrypter
  while locating org.apache.maven.repository.legacy.LegacyRepositorySystem
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.repository.RepositorySystem
  while locating org.apache.maven.project.DefaultProjectBuildingHelper
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.project.ProjectBuildingHelper
  while locating org.apache.maven.project.DefaultProjectBuilder
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.project.ProjectBuilder
  while locating org.apache.maven.DefaultMaven
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.Maven

1 error
[ERROR] Caused by: Type javax.enterprise.inject.Typed not present
[ERROR] Caused by: javax.enterprise.inject.Typed

我已经确认 JRE 系统库是 WAS 7,方法是检查它是 JavaSE-1.6,在我的例子中指向 WAS7。

我曾尝试寻找 javax.enterprise.inject.Typed,但它似乎没有出现在任何地方,但它是 JavaEE6 的一部分,这是(我认为)WAS 7 的构建基础。

【问题讨论】:

  • WAS7 只支持 Java EE 5,不支持 Java EE 6。所以你不会有任何运气。
  • 我明白了,谢谢!我想我在查找环境时打错了。不过,我似乎并没有明确地在任何地方包含 guice.. 这真的让我感到困惑..
  • 会是传递依赖吗?试试mvn dependency:tree 看看它来自哪里。
  • 我开始怀疑它是我自己使用的 maven 版本,经过一些额外的谷歌搜索后,我发现 Maven 3+ 使用 guice 进行依赖注入而不是 plexus。这是不得已而为之的事情,但我会尝试将 maven 带回 2.2.1,看看会发生什么。
  • 我已经证实了我的怀疑,切换到 maven 2.2.1 解决了这个问题!我会这样更新答案。

标签: java spring maven guice websphere-7


【解决方案1】:

所以基本上发生的事情是我使用的是与 myeclipse 一起打包的嵌入式 Maven 版本。

这个版本的 maven 是 v3.0.4,它使用 guice 而不是 plexus 来注入依赖项。 Guice 使用了由 WAS7 扩展的 JavaEE5 中不存在的 JavaEE6 组件。

所以本质上解决这个问题指向

【讨论】:

    【解决方案2】:

    SpaceTrucker 的评论很到位。缺失的类是 JavaEE 6 的一部分,WAS7 只支持 JavaEE 5。特性对比见The Wikipedia entry

    【讨论】:

    • 是的,我刚刚注意到,奇怪的是我没有在任何地方明确使用 guice。所以我将不得不弄清楚我猜是哪些依赖项。谢谢你们的帮助! :)
    【解决方案3】:

    转到 RAD -> 窗口-->首选项-->Maven-->安装

    添加你的maven文件夹路径

    现在转到项目并右键单击项目-->Maven-->更新项目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-23
      • 2021-09-15
      • 2013-06-16
      • 1970-01-01
      • 1970-01-01
      • 2014-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多