非常基本的错误:我在第一批调用中定义了错误安装的jar文件的路径。所以解决了。
我正在尝试为我的数据库应用程序安装和使用JDBC-DB2驱动程序。好像没有这个存储库,所以我尝试安装驱动程序文件(db2jcc4.jar)和我使用以下批处理文件获得的许可证(db2jcc_license_cu.jar):
call mvn install:install-file -Dfile=db2jcc4.jar -DgroupId=com.ibm.db2 -DartifactId=db2jcc4 -Dversion=3.1.57 -Dpackaging=jar -DgeneratePom=true
call mvn install:install-file -Dfile=db2jcc_license_cu.jar -DgroupId=com.ibm.db2 -DartifactId=db2jcc_license_cu -Dversion=3.1.57 -Dpackaging=jar -DgeneratePom=true
效果很好(Build :: Sucess)
但是当我尝试通过将它们添加到我的pom.xml中来访问项目中的文件时:
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>3.1.57</version>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc_license_cu</artifactId>
<version>3.1.57</version>
</dependency>
并致电
mvn compile
然后我得到了
[ERROR] Failed to execute goal on project hibernate-tutorial: Could not resolve
dependencies for project org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SN
APSHOT: Failure to find com.ibm.db2:db2jcc4:jar:3.1.57 in http://repo.maven.apac
he.org/maven2 was cached in the local repository, resolution will not be reattem
pted until the update interval of central has elapsed or updates are forced -> [
Help 1]
[ERROR]
我对maven并不熟悉,但显然它试图解决中心的依赖关系并且没有在我的本地回购中找到它们,这就是我想请求你帮助的地方;)
(是的,数据库应用意味着hibernate教程(http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/tutorial.html)在此上下文中:D)
编辑:
详细的错误报告:
mvn -X compile
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:
28+0100)
Maven home: C:\Program Files (x86)\Apache Software Foundation\apache-maven-3.0.5
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.7.0_17\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "x86", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\Program Files (x86)\Apache Software Foun
dation\apache-maven-3.0.5\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\MyName\.m2\settings.xml
[DEBUG] Using local repository at C:\maven\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\mav
en\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.hibernate.tutorials:hibernate-tutorial:
jar:1.0.0-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.co
re, parent: null]
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artif
actId} instead.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
[DEBUG] Tasks: [compile]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-so
urces, generate-resources, process-resources, compile, process-classes, generate
-test-sources, process-test-sources, generate-test-resources, process-test-resou
rces, test-compile, process-test-classes, test, prepare-package, package, pre-in
tegration-test, integration-test, post-integration-test, verify, install, deploy
]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-so
urces, generate-resources, process-resources, compile, process-classes, generate
-test-sources, process-test-sources, generate-test-resources, process-test-resou
rces, test-compile, process-test-classes, test, prepare-package, package, pre-in
tegration-test, integration-test, post-integration-test, verify, install, deploy
]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-so
urces, generate-resources, process-resources, compile, process-classes, generate
-test-sources, process-test-sources, generate-test-resources, process-test-resou
rces, test-compile, process-test-classes, test, prepare-package, package, pre-in
tegration-test, integration-test, post-integration-test, verify, install, deploy
]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: org.hibernate.tutorials:hibernate-tutorial:1.0.0-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [compile]
[DEBUG] Repositories (dependencies): [central (http://repo.maven.apache.org/mave
n2, releases)]
[DEBUG] Repositories (plugins) : [central (http://repo.maven.apache.org/mave
n2, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.maven.plugins:maven-resources-plugin:2.5:resou
rces (default-resources)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<buildFilters default-value="${project.build.filters}"/>
<encoding default-value="${project.build.sourceEncoding}">${encoding}</encodin
g>
<escapeString>${maven.resources.escapeString}</escapeString>
<escapeWindowsPaths default-value="true">${maven.resources.escapeWindowsPaths}
</escapeWindowsPaths>
<includeEmptyDirs default-value="false">${maven.resources.includeEmptyDirs}</i
ncludeEmptyDirs>
<outputDirectory default-value="${project.build.outputDirectory}"/>
<overwrite default-value="false">${maven.resources.overwrite}</overwrite>
<project default-value="${project}"/>
<resources default-value="${project.resources}"/>
<session default-value="${session}"/>
<supportMultiLineFiltering default-value="false">${maven.resources.supportMult
iLineFiltering}</supportMultiLineFiltering>
<useBuildFilters default-value="true"/>
<useDefaultDelimiters default-value="true"/>
</configuration>
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:comp
ile (default-compile)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<basedir default-value="${basedir}"/>
<buildDirectory default-value="${project.build.directory}"/>
<classpathElements default-value="${project.compileClasspathElements}"/>
<compileSourceRoots default-value="${project.compileSourceRoots}"/>
<compilerId default-value="javac">${maven.compiler.compilerId}</compilerId>
<compilerVersion>${maven.compiler.compilerVersion}</compilerVersion>
<debug default-value="true">${maven.compiler.debug}</debug>
<debuglevel>${maven.compiler.debuglevel}</debuglevel>
<encoding default-value="${project.build.sourceEncoding}">${encoding}</encodin
g>
<executable>${maven.compiler.executable}</executable>
<failOnError default-value="true">${maven.compiler.failOnError}</failOnError>
<fork default-value="false">${maven.compiler.fork}</fork>
<generatedSourcesDirectory default-value="${project.build.directory}/generated
-sources/annotations"/>
<maxmem>${maven.compiler.maxmem}</maxmem>
<meminitial>${maven.compiler.meminitial}</meminitial>
<optimize default-value="false">${maven.compiler.optimize}</optimize>
<outputDirectory default-value="${project.build.outputDirectory}"/>
<outputFileName>${project.build.finalName}</outputFileName>
<projectArtifact default-value="${project.artifact}"/>
<session default-value="${session}"/>
<showDeprecation default-value="false">${maven.compiler.showDeprecation}</show
Deprecation>
<showWarnings default-value="false">${maven.compiler.showWarnings}</showWarnin
gs>
<source default-value="1.5">${maven.compiler.source}</source>
<staleMillis default-value="0">${lastModGranularityMs}</staleMillis>
<target default-value="1.5">${maven.compiler.target}</target>
<verbose default-value="false">${maven.compiler.verbose}</verbose>
</configuration>
[DEBUG] =======================================================================
[DEBUG] Could not find metadata javax.servlet:servlet-api/maven-metadata.xml in
local (C:\maven\repository)
[DEBUG] Skipped remote update check for javax.servlet:servlet-api/maven-metadata
.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata javassist:javassist/maven-metadata.xml in local
(C:\maven\repository)
[DEBUG] Skipped remote update check for javassist:javassist/maven-metadata.xml,
locally cached metadata up-to-date.
[DEBUG] org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
[DEBUG] org.hibernate:hibernate-core:jar:3.3.1.GA:compile
[DEBUG] antlr:antlr:jar:2.7.6:compile
[DEBUG] commons-collections:commons-collections:jar:3.1:compile
[DEBUG] dom4j:dom4j:jar:1.6.1:compile
[DEBUG] xml-apis:xml-apis:jar:1.0.b2:compile
[DEBUG] javax.transaction:jta:jar:1.1:compile
[DEBUG] javax.servlet:servlet-api:jar:2.4:compile
[DEBUG] org.slf4j:slf4j-simple:jar:1.5.6:compile
[DEBUG] org.slf4j:slf4j-api:jar:1.5.6:compile
[DEBUG] javassist:javassist:jar:3.12.1.GA:compile
[DEBUG] org.hsqldb:hsqldb:jar:2.2.9:compile
[DEBUG] com.ibm.db2:db2jcc4:jar:3.1.57:compile
[DEBUG] com.ibm.db2:db2jcc_license_cu:jar:3.1.57:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.432s
[INFO] Finished at: Mon Jun 24 00:12:09 CEST 2013
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project hibernate-tutorial: Could not resolve
dependencies for project org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SN
APSHOT: Failure to find com.ibm.db2:db2jcc4:jar:3.1.57 in http://repo.maven.apac
he.org/maven2 was cached in the local repository, resolution will not be reattem
pted until the update interval of central has elapsed or updates are forced -> [
Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
n project hibernate-tutorial: Could not resolve dependencies for project org.hib
ernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT: Failure to find com.ibm.
db2:db2jcc4:jar:3.1.57 in http://repo.maven.apache.org/maven2 was cached in the
local repository, resolution will not be reattempted until the update interval o
f central has elapsed or updates are forced
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
pendencies(LifecycleDependencyResolver.java:210)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resol
veProjectDependencies(LifecycleDependencyResolver.java:117)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAr
eResolved(MojoExecutor.java:258)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:201)
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.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not res
olve dependencies for project org.hibernate.tutorials:hibernate-tutorial:jar:1.0
.0-SNAPSHOT: Failure to find com.ibm.db2:db2jcc4:jar:3.1.57 in http://repo.maven
.apache.org/maven2 was cached in the local repository, resolution will not be re
attempted until the update interval of central has elapsed or updates are forced
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(D
efaultProjectDependenciesResolver.java:189)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
pendencies(LifecycleDependencyResolver.java:185)
... 22 more
Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Failure
to find com.ibm.db2:db2jcc4:jar:3.1.57 in http://repo.maven.apache.org/maven2 w
as cached in the local repository, resolution will not be reattempted until the
update interval of central has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe
ndencies(DefaultRepositorySystem.java:375)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(D
efaultProjectDependenciesResolver.java:183)
... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure t
o find com.ibm.db2:db2jcc4:jar:3.1.57 in http://repo.maven.apache.org/maven2 was
cached in the local repository, resolution will not be reattempted until the up
date interval of central has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def
aultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
facts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe
ndencies(DefaultRepositorySystem.java:358)
... 24 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to fi
nd com.ibm.db2:db2jcc4:jar:3.1.57 in http://repo.maven.apache.org/maven2 was cac
hed in the local repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.newExcept
ion(DefaultUpdateCheckManager.java:230)
at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArti
fact(DefaultUpdateCheckManager.java:204)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def
aultArtifactResolver.java:427)
... 26 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
答案 0 :(得分:0)
非常基本的错误:我在第一批调用中定义了错误安装jar文件的路径。