2016-08-15 181 views
0

我正在收到maven编译错误包COM.ibm.db2.jdbc.app不存在,当我试图建立我的maven项目与db2罐和拉链。获取编译失败的maven构建..包COM.ibm.db2.jdbc.app不存在

代码编译为RAD中的db2 jars/zip。

我的nexus reposistory定义了以下文件和依赖项,我也可以在我的pom中使用它们。

<dependency> 
    <groupId>com.ibm.db2</groupId> 
    <artifactId>db2jcc4</artifactId> 
    <version>9.5.7</version> 
</dependency> 
<dependency> 
<groupId>com.ibm.db2</groupId> 
<artifactId>db2jcc_license_cu</artifactId> 
<version>9.5.7</version> 
</dependency> 
<dependency> 
<groupId>com.ibm.db2</groupId> 
<artifactId>db2java</artifactId> 
<version>9.5.7</version> 
<type>zip</type> 
<scope>compile</scope> 
</dependency> 

这是使用这种源代码..

private boolean executeConnectionPackage(Connection spConnection, String csSpDbPackage) 
{ 
    try 
    { 
     COM.ibm.db2.jdbc.app.DB2Connection Db2connection = null;// (COM.ibm.db2.jdbc.app.DB2Connection)spConnection; 
     Db2connection.setConnectOption(1276, csSpDbPackage); // SQL_ATTR_CURRENT_PACKAGE_SET 
     Log.logNormal("Change Package:" + csSpDbPackage); 
    } 
    catch (Exception ex) 
    { 
     Log.logNormal("Problem with change Package:" + csSpDbPackage + " ex:" + ex.getMessage()); 
     return false; 
    } 
    return true; 
} 

更新MAVEN例外

[INFO] ------------------------------------------------------------- 
    [ERROR] COMPILATION ERROR : 
    [INFO] ------------------------------------------------------------- 
    [ERROR] /C:/Development/eclipse//workspace/ExecuteCRuntime/src/spServer/StoredProcedure.java:[31,1] package COM.ibm.db2.jdbc.app does not exist 
    [ERROR] /C:/Development/eclipse//workspace/ExecuteCRuntime/src/spServer/StoredProcedure.java:[181,45] package COM.ibm.db2.jdbc.app does not exist 
    [INFO] 2 errors 
    [INFO] ------------------------------------------------------------- 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] BUILD FAILURE 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project ExecuteCRuntime: Compilation failure: Compilation failure: 

UPDATE运行行家与-e

[ERROR] -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project ExecuteCRuntime: 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:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    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) 
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure 
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911) 
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    ... 20 more 

我的pom DB2 Jars/zip文件的依赖关系。这是在全球范围内入店公司范围内的关系定义回购

<dependency> 
    <groupId>com.ibm.db2</groupId> 
    <artifactId>db2jcc4</artifactId> 
    <version>9.5.7</version> 
</dependency> 
<dependency> 
<groupId>com.ibm.db2</groupId> 
<artifactId>db2jcc_license_cu</artifactId> 
<version>9.5.7</version> 
</dependency> 
<dependency> 
<groupId>com.ibm.db2</groupId> 
<artifactId>db2java</artifactId> 
<version>9.5.7</version> 
<type>zip</type> 
<scope>compile</scope> 
</dependency> 

这里是整个双龙

<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>ExecuteCRuntime</groupId> 
    <artifactId>ExecuteCRuntime</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 

    <dependencies> 

    <!-- https://mvnrepository.com/artifact/log4j/log4j --> 
<dependency> 
    <groupId>log4j</groupId> 
    <artifactId>log4j</artifactId> 
    <version>1.2.17</version> 
</dependency> 
    <!-- https://mvnrepository.com/artifact/ant/ant --> 
    <!-- 
<dependency> 
    <groupId>ant</groupId> 
    <artifactId>ant</artifactId> 
    <version>1.7.0</version> 
</dependency> 
--> 
    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec --> 
<dependency> 
    <groupId>commons-codec</groupId> 
    <artifactId>commons-codec</artifactId> 
    <version>1.10</version> 
</dependency> 
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io --> 
<dependency> 
    <groupId>org.apache.commons</groupId> 
    <artifactId>commons-io</artifactId> 
    <version>1.3.2</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --> 
<dependency> 
    <groupId>commons-logging</groupId> 
    <artifactId>commons-logging</artifactId> 
    <version>1.2</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/commons-net/commons-net --> 
<dependency> 
    <groupId>commons-net</groupId> 
    <artifactId>commons-net</artifactId> 
    <version>1.4.1</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/com.sleepycat/je --> 
<!-- https://mvnrepository.com/artifact/com.sleepycat/je --> 
<dependency> 
    <groupId>com.projectdarkstar.ext.berkeleydb</groupId> 
    <artifactId>je</artifactId> 
    <version>3.2.23</version> 
</dependency> 

<!-- https://mvnrepository.com/artifact/com.sun.media/jai_codec --> 


<dependency> 
    <groupId>com.ibm.db2</groupId> 
    <artifactId>db2jcc4</artifactId> 
    <version>9.5.7</version> 
</dependency> 
     <dependency> 
      <groupId>com.ibm.db2</groupId> 
      <artifactId>db2jcc_license_cu</artifactId> 
      <version>9.5.7</version> 
     </dependency> 
     <dependency> 
      <groupId>com.ibm.db2</groupId> 
      <artifactId>db2java</artifactId> 
      <version>9.5.7</version> 
      <type>zip</type> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.activation</groupId> 
      <artifactId>activation</artifactId> 
      <version>1.1.1</version> 
     </dependency> 
    <!-- https://mvnrepository.com/artifact/junit/junit --> 
<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.12</version> 
</dependency> 
    <!-- https://mvnrepository.com/artifact/xml-apis/xml-apis --> 
<dependency> 
    <groupId>xml-apis</groupId> 
    <artifactId>xml-apis</artifactId> 
    <version>2.0.2</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/xalan/serializer --> 
<dependency> 
    <groupId>xalan</groupId> 
    <artifactId>serializer</artifactId> 
    <version>2.7.2</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> 
<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>javax.servlet-api</artifactId> 
    <version>3.1.0</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api --> 
<dependency> 
    <groupId>javax.mail</groupId> 
    <artifactId>javax.mail-api</artifactId> 
    <version>1.5.5</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/xerces/xercesImpl --> 
<dependency> 
    <groupId>xerces</groupId> 
    <artifactId>xercesImpl</artifactId> 
    <version>2.8.0</version> 
</dependency> 
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 --> 
<dependency> 
    <groupId>com.oracle</groupId> 
    <artifactId>ojdbc</artifactId> 
    <version>1.4</version> 
</dependency> 

    </dependencies> 
    <build> 
    <sourceDirectory>src</sourceDirectory> 
    <resources> 
     <resource> 
     <directory>src</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.3</version> 

     <configuration> 
     <!-- <compilerArgument>-XDignore.symbol.file</compilerArgument> --> 
      <source>1.8</source> 
      <target>1.8</target> 
     </configuration> 
     </plugin> 
    </plugins> 

    </build> 
</project> 

任何人都可以请帮助我,让我知道我在这里失踪。

由于 Dhiren

+0

请发布异常堆栈跟踪。 – 11thdimension

+0

没有异常堆栈跟踪这是来自maven的编译错误。 – user2358826

+0

@ user2358826使用'-e'键运行maven – vsminkov

回答

2

应用驱动器(COM.ibm.db2.jdbc.app)长期以来被弃用;它需要安装本地DB2 CLI驱动程序。您应该使用JCC驱动程序(com.ibm.db2.jcc)。 More info in the manual

+0

这是否意味着我应该更改它使用COM.ibm.db2.jdbc的代码。应用程序。这与RAD工作,但不编译与Maven构建?为什么它甚至找不到db2java.zip。它应该在构建期间由maven拉入 – user2358826

0

我更改了代码来处理应用程序驱动程序。 Class dbs = Class.forName(“COM.ibm.db2.jdbc.app.DB2Connection”); 方法m = dbs.getDeclaredMethod(“setConnectOption”,Integer.TYPE,String.class);