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信息。
学是仓库的原因,将仓库地址改为阿里的后,即可以正常的下载了,但是升级改为 sqljdbc42,6.0版本的也不行。至少目前是可以用了。
mvn install:help -Ddetail=true
执行下看看结果。
没用,应该是通过仓库地址下载不到.pom文件;