java 缺少 jdbc.artifact.groupid:jdbc-driver:jar:1.0 的依赖信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12153435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 07:48:37  来源:igfitidea点击:

Missing dependancy information for jdbc.artifact.groupid:jdbc-driver:jar:1.0

javahibernatemavenmaven-pluginhbm2java

提问by Prasad S Deshpande

I am trying to use hbm2java maven plugins for hibernate. For mvn hibernate3:hbm2cfgxml goal I am facing following error.

我正在尝试使用 hbm2java maven 插件进行休眠。对于 mvn hibernate3:hbm2cfgxml 目标,我面临以下错误。

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app-hadoop 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> hibernate3-maven-plugin:2.2:hbm2cfgxml (default-cli) @ my-app-hadoop >>>
[INFO]
[INFO] <<< hibernate3-maven-plugin:2.2:hbm2cfgxml (default-cli) @ my-app-hadoop <<<
[INFO]
[INFO] --- hibernate3-maven-plugin:2.2:hbm2cfgxml (default-cli) @ my-app-hadoop ---
[WARNING] The POM for jdbc.artifact.groupid:jdbc-driver:jar:1.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.454s
[INFO] Finished at: Tue Aug 28 11:14:20 IST 2012
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-   plugin:2.2:hbm2cfgxml (default-cli) on project my-app-hadoop: Ex
ecution default-cli of goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2cfgxml   failed: Plugin org.codehaus.mojo:hibernate3-m
aven-plugin:2.2 or one of its dependencies could not be resolved: Failure to find  jdbc.artifact.groupid:jdbc-driver:jar:1.0 in htt
p://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval
of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/PluginResolutionException

I have added following plugin configuration in POM.xml to use hbm2java capabilities.

我在 POM.xml 中添加了以下插件配置以使用 hbm2java 功能。

<build>
<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>hibernate3-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
      <components>
        <component>
          <name>hbm2ddl</name>
          <implementation>jdbcconfiguration</implementation>
        </component>
        <component>
          <name>hbm2hbmxml</name>
          <outputDirectory>src/main/resources</outputDirectory>
        </component>
      </components>
      <componentProperties>
        <drop>true</drop>
        <configurationfile>/src/main/resources/hibernate.cfg.xml</configurationfile>
      </componentProperties>
    </configuration>
    <dependencies>
      <dependency>
        <groupId>jdbc.artifact.groupid</groupId>
        <artifactId>jdbc-driver</artifactId>
        <version>1.0</version>
      </dependency>
    </dependencies>
  </plugin>
</plugins>

Where would I find jdbc.artifact.groupid and what is missing in my pom.xml?

我在哪里可以找到 jdbc.artifact.groupid 以及我的 pom.xml 中缺少什么?

采纳答案by Yanflea

You must replace jdbc.artifact.groupid:jdbc-driver:1.0 by a real vendor artifact. For instance

您必须用真正的供应商工件替换 jdbc.artifact.groupid:jdbc-driver:1.0。例如

<dependency>
    <groupId>org.hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>2.2.8</version>
</dependency>

if you use hsqldb.

如果你使用 hsqldb。

EDIT

编辑

As you mention you use Oracle in your comment... The jdbc jar for Oracle db is provided with your Oracle distribution. You can also download it here.Once downloaded you will have to put it manually in your local maven repo (you can also store it in the thirparty repo of you Maven Repo Manager if you have one (Nexus, Archiva...). An other way is to add the dependency by using the systemPathdeclaration :

正如您在评论中提到的,您使用 Oracle... Oracle db 的 jdbc jar 随您的 Oracle 发行版提供。您也可以在此处下载。下载后,您必须手动将其放入本地 Maven 存储库中(如果您有一个(Nexus、Archiva...),也可以将其存储在 Maven 存储库管理器的第三方存储库中。另一种方法是使用systemPath声明添加依赖项:

<dependency>
   <groupId>com.oracle.jdbc</groupId>
   <artifactId>ojdbc6_g</artifactId>
   <version>11.2.0.2.0</version>
   <systemPath>"C:/ThirpartyJars/Oracle/ojdbc6_g.jar"</systemPath>
</dependency>

回答by Sai Ye Yan Naing Aye

Replace your dependency

替换你的依赖

   <dependency>
    <groupId>jdbc.artifact.groupid</groupId>
    <artifactId>jdbc-driver</artifactId>
    <version>1.0</version>
  </dependency>

to

   <dependency>
     <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
         <version>11.2.0</version>
   </dependency>