首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven构建-无法解决依赖关系

Maven构建-无法解决依赖关系
EN

Stack Overflow用户
提问于 2017-02-16 02:27:06
回答 1查看 1.2K关注 0票数 0

OS:OSX Yosemite

Eclipse:开普勒

问题:

  1. 从Eclipse运行:maven-编译器-plugin丢失
  2. 从命令行:未能找到com.microsoft.sqlserver:sqljdbc4 4:jar:2.0

我有一个pom.xml (部分)定义的maven项目,在看到这个问题后,我在项目目录中手动执行了Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar,其中定义了pom.xml,其结果是构建成功。然而,当我运行maven构建时,我得到了错误2。当我试图在eclipse中运行时,我得到了错误1

MVN:

代码语言:javascript
复制
mvn -version    
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T10:41:47-06:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec

POM.XML:

代码语言:javascript
复制
<dependency> 
    <groupId>com.microsoft.sqlserver</groupId> 
    <artifactId>sqljdbc4</artifactId> 
    <version>2.0</version>
    <scope>runtime</scope>
</dependency>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
    <configuration>
    <compilerVersion>1.6</compilerVersion>
    <target>1.6</target>
    <source>1.6</source>
    <fork>true</fork>
    </configuration>
</plugin>

错误1:

代码语言:javascript
复制
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.
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for XXXXXXXXXX:war:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 139, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.   

错误2:

代码语言:javascript
复制
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for XXXXXXX:war:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 139, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building XXXXXX 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.microsoft.sqlserver:sqljdbc4:jar:2.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.381 s
[INFO] Finished at: 2017-02-15T20:04:48-06:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project XXXXXX: Could not resolve dependencies for project XXXXXXXXX:war:0.0.1-SNAPSHOT: Failure to find com.microsoft.sqlserver:sqljdbc4:jar:2.0 in https://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]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project XXXXXX: Could not resolve dependencies for project XXXXXXXXX:war:0.0.1-SNAPSHOT: Failure to find com.microsoft.sqlserver:sqljdbc4:jar:2.0 in https://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
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)

参考:

我确实参考了this的帖子,但无法解决这个问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-16 14:52:13

需要在maven目录中添加sqlserver文件,如下所述,

代码语言:javascript
复制
Path : /Users/xxxxx/.m2/repository/com/microsoft/sqlserver/sqljdbc4/2.0
File: sqljdbc4-2.0.jar
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42263716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档