data-collector/src/main/java/se/kth/depclean/experiments/util/PomDownloader.java
/**
     * This method downloads a pom file from the Maven Central repository.
     *
     * @param artifactDir Directory to put the pom file.
     * @param groupId     The artifact groupId.
     * @param artifactId  The artifact artifactId.
     * @param version     The artifact version.
     * @throws IOException
     */
This method downloads a pom file from the Maven Central repository.
@param artifactDir Directory to put the pom file.
@param groupId     The artifact groupId.
@param artifactId  The artifact artifactId.
@param version     The artifact version.
This method downloads a pom file from the Maven Central repository . @param artifactDir Directory to put the pom file . @param groupId The artifact groupId . @param artifactId The artifact artifactId . @param version The artifact version .
public static void downloadPom(String artifactDir, String groupId, String artifactId, String version) throws IOException {
        URL url;
        try {
            url = new URL("http://central.maven.org/maven2/" +
                    groupId.replace('.', '/') + "/" +
                    artifactId + "/" +
                    version + "/" +
                    artifactId + "-" + version + ".pom");
            FileUtils.copyURLToFile(url, new File(artifactDir + "pom.xml"));
        } catch (Exception a) {
            try {
                url = new URL("https://repo1.maven.org/maven2/" +
                        groupId.replace('.', '/') + "/" +
                        artifactId + "/" +
                        version + "/" +
                        artifactId + "-" + version + ".pom");
                FileUtils.copyURLToFile(url, new File(artifactDir + "pom.xml"));
            } catch (Exception b) {
                try {
                    url = new URL("https://repo.maven.apache.org/maven2/" +
                            groupId.replace('.', '/') + "/" +
                            artifactId + "/" +
                            version + "/" +
                            artifactId + "-" + version + ".pom");
                    FileUtils.copyURLToFile(url, new File(artifactDir + "pom.xml"));
                } catch (Exception d) {
                    throw d;
                }
            }
        }
    }
public static void downloadPom ( String artifactDir , String groupId , String artifactId , String version ) throws IOException { URL url ; try { url = new URL ( "http://central.maven.org/maven2/" + groupId . replace ( '.' , '/' ) + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".pom" ) ; FileUtils . copyURLToFile ( url , new File ( artifactDir + "pom.xml" ) ) ; } catch ( Exception a ) { try { url = new URL ( "https://repo1.maven.org/maven2/" + groupId . replace ( '.' , '/' ) + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".pom" ) ; FileUtils . copyURLToFile ( url , new File ( artifactDir + "pom.xml" ) ) ; } catch ( Exception b ) { try { url = new URL ( "https://repo.maven.apache.org/maven2/" + groupId . replace ( '.' , '/' ) + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".pom" ) ; FileUtils . copyURLToFile ( url , new File ( artifactDir + "pom.xml" ) ) ; } catch ( Exception d ) { throw d ; } } } }
This method downloads a pom file from the Maven Central repository.
This method downloads a pom file from the Maven Central repository .
// download pom from maven repo // download pom from maven repo // download pom from maven repo