问题描述:
Failure to transfer org.apache.maven:maven-archiver:pom:2.5 from
https://maven.aliyun.com/repository/public was cached in the local repository, resolution
will not be reattempted until the update interval of aliyunmaven has elapsed or updates are forced.
Original error: Could not transfer artifact org.apache.maven:maven-archiver:pom:2.5 from/to
aliyunmaven (https://maven.aliyun.com/repository/public): PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid
certification path to requested target
maven用了阿里云镜像,之前一直没问题,今天突然显示要安全证书,网上找了方法:
方法一,生成jssecacerts(本人多次尝试,没有解决我的问题)
创建Java文件,InstallCert.java,代码:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.security.KeyStore;
import java.security.MessageDigest;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
public class InstallCert {
public static void main(String[] args) throws Exception {
String host;
int port;
char[] passphrase;
if ((args.length == 1) || (args.length == 2)) {
String[] c = args[0].split(":");
host = c[0];
port = (c.length == 1) ? 443 : Integer.parseInt(c[1]);
String p = (args.length == 1) ?