Search in sources :

Example 1 with InvalidArchiveException

use of com.redhat.ceylon.cmr.impl.InvalidArchiveException in project ceylon-compiler by ceylon.

the class CeylonEnter method addOutputModuleToClassPath.

public void addOutputModuleToClassPath(Module module) {
    RepositoryManager repositoryManager = fileManager.getOutputRepositoryManager();
    ArtifactResult artifact = null;
    try {
        ArtifactContext ctx = new ArtifactContext(module.getNameAsString(), module.getVersion(), ArtifactContext.CAR, ArtifactContext.JAR);
        artifact = repositoryManager.getArtifactResult(ctx);
    } catch (InvalidArchiveException e) {
        log.error("ceylon", "Module car " + e.getPath() + " obtained from repository " + e.getRepository() + " has an invalid SHA1 signature: you need to remove it and rebuild the archive, since it" + " may be corrupted.");
    } catch (Exception e) {
        String moduleName = module.getNameAsString();
        if (!module.isDefault())
            moduleName += "/" + module.getVersion();
        log.error("ceylon", "Exception occured while trying to resolve module " + moduleName);
        e.printStackTrace();
    }
    addModuleToClassPath(module, false, artifact);
}
Also used : InvalidArchiveException(com.redhat.ceylon.cmr.impl.InvalidArchiveException) RepositoryManager(com.redhat.ceylon.cmr.api.RepositoryManager) ArtifactContext(com.redhat.ceylon.cmr.api.ArtifactContext) InvalidArchiveException(com.redhat.ceylon.cmr.impl.InvalidArchiveException) ArtifactResult(com.redhat.ceylon.model.cmr.ArtifactResult)

Aggregations

ArtifactContext (com.redhat.ceylon.cmr.api.ArtifactContext)1 RepositoryManager (com.redhat.ceylon.cmr.api.RepositoryManager)1 InvalidArchiveException (com.redhat.ceylon.cmr.impl.InvalidArchiveException)1 ArtifactResult (com.redhat.ceylon.model.cmr.ArtifactResult)1