首页 新闻 搜索 专区 学院

maven 安装sqlserver4 依赖报错:Unknown lifecycle phase ".microsoft.sqlserver".

0
悬赏园豆:5 [已解决问题] 解决于 2020-05-26 11:41

IDEA内POM.XML中引入了了SQLServer的包
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0.0</version>
</dependency>

下载包即报错:
Could not transfer artifact com.microsoft.sqlserver:sqljdbc4:pom:4.0.0 from/to repo1 (https://repo1.maven.org/maven2/): Transfer failed for https://repo1.maven.org/maven2/com/microsoft/sqlserver/sqljdbc4/4.0.0/sqljdbc4-4.0.0.pom

根据网上的提示,表示微信不允许maven自动下载包,要用命令的方式进行安装,我在maven创库中下载到了sqljdbc4-4.0.jar 的包,放在了仓库的根目录下,然后执行以下命令:
mvn install:install-file -Dfile=D:\apache-maven-3.6.3\repository\sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0

运行后报如下错误:
Unknown lifecycle phase ".microsoft.sqlserver". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
下面字体为红色
org.apache.maven.lifecycle.LifecyclePhaseNotFoundException: Unknown lifecycle phase ".microsoft.sqlserver". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.

根据错误的链接,我执行了以下命令:

第一步:mvn install

第二步:mvn compiler:compile

第三步:mvn org.apache.maven.plugins:maven-compiler-plugin:compile

第四步:mvn org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile

并无效果,特上来博客园来请教,怎么会找不到Unknown lifecycle phase ".microsoft.sqlserver"

对maven的命令不熟,输入了maven -X命令,提示了一堆DEBUG信息。

beggar_的主页 beggar_ | 初学一级 | 园豆:23
提问于:2020-05-24 23:11
< >
分享
最佳答案
0

学是仓库的原因,将仓库地址改为阿里的后,即可以正常的下载了,但是升级改为 sqljdbc42,6.0版本的也不行。至少目前是可以用了。

beggar_ | 初学一级 |园豆:23 | 2020-05-26 11:04
其他回答(1)
0

mvn install:help -Ddetail=true执行下看看结果。

收获园豆:5
blackheart | 园豆:3290 (老鸟四级) | 2020-05-25 10:30

没用,应该是通过仓库地址下载不到.pom文件;

支持(0) 反对(0) beggar_ | 园豆:23 (初学一级) | 2020-05-26 11:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册