Search in sources :

Example 1 with InvalidArchiveException

use of org.eclipse.ceylon.cmr.impl.InvalidArchiveException in project ceylon by eclipse.

the class CeylonEnter method addOutputModuleToClassPath.

public void addOutputModuleToClassPath(Module module) {
    RepositoryManager repositoryManager = fileManager.getOutputRepositoryManager();
    ArtifactResult artifact = null;
    try {
        ArtifactContext ctx = new ArtifactContext(null, module.getNameAsString(), module.getVersion(), ArtifactContext.CAR, ArtifactContext.JAR);
        artifact = repositoryManager.getArtifactResult(ctx);
    } catch (InvalidArchiveException e) {
        log.warning("ceylon", "Module car " + e.getPath() + " obtained from repository " + e.getRepository() + " has an invalid SHA1 signature:" + " it will be overwritten but if the problem" + " persists you need to remove it and rebuild the module, since it may be corrupted.");
    } catch (Exception e) {
        String moduleName = module.getNameAsString();
        if (!module.isDefaultModule())
            moduleName += "/" + module.getVersion();
        log.error("ceylon", "Exception occured while trying to resolve module " + moduleName);
        e.printStackTrace();
    }
    if (artifact == null || JarUtils.isValidJar(artifact.artifact())) {
        addModuleToClassPath(module, false, artifact);
    } else {
        log.warning("ceylon", "Module car " + artifact.artifact() + " obtained from repository " + artifact.repository() + " could not be read:" + " it will be overwritten but if the problem" + " persists you need to remove it and rebuild the module, since it may be corrupted.");
    }
}
Also used : InvalidArchiveException(org.eclipse.ceylon.cmr.impl.InvalidArchiveException) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) InvalidArchiveException(org.eclipse.ceylon.cmr.impl.InvalidArchiveException) IOException(java.io.IOException) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult)

Aggregations

IOException (java.io.IOException)1 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)1 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)1 InvalidArchiveException (org.eclipse.ceylon.cmr.impl.InvalidArchiveException)1 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)1