Java Code Examples for org.apache.ivy.core.module.descriptor.ModuleDescriptor#getPublicationDate()

The following examples show how to use org.apache.ivy.core.module.descriptor.ModuleDescriptor#getPublicationDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
protected long getPublicationDate(ModuleDescriptor md, DependencyDescriptor dd, ResolveData data) {
    if (md.getPublicationDate() != null) {
        return md.getPublicationDate().getTime();
    }
    ResolvedResource artifactRef = findFirstArtifactRef(md, dd, data);
    if (artifactRef != null) {
        return artifactRef.getLastModified();
    }
    return -1;
}
 
Example 2
Source File: IvyDependencyUpdateChecker.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public void doExecute() throws BuildException {
    prepareAndCheck();

    ModuleDescriptor originalModuleDescriptor = getResolvedReport().getModuleDescriptor();
    // clone module descriptor
    DefaultModuleDescriptor latestModuleDescriptor = new DefaultModuleDescriptor(
            originalModuleDescriptor.getModuleRevisionId(),
            originalModuleDescriptor.getStatus(), originalModuleDescriptor.getPublicationDate());
    // copy configurations
    for (Configuration configuration : originalModuleDescriptor.getConfigurations()) {
        latestModuleDescriptor.addConfiguration(configuration);
    }
    // clone dependency and add new one with the requested revisionToCheck
    for (DependencyDescriptor dependencyDescriptor : originalModuleDescriptor.getDependencies()) {
        ModuleRevisionId upToDateMrid = ModuleRevisionId.newInstance(
            dependencyDescriptor.getDependencyRevisionId(), revisionToCheck);
        latestModuleDescriptor.addDependency(dependencyDescriptor.clone(upToDateMrid));
    }

    // resolve
    ResolveOptions resolveOptions = new ResolveOptions();
    resolveOptions.setDownload(isDownload());
    resolveOptions.setLog(getLog());
    resolveOptions.setConfs(splitToArray(getConf()));
    resolveOptions.setCheckIfChanged(checkIfChanged);

    ResolveReport latestReport;
    try {
        latestReport = getIvyInstance().getResolveEngine().resolve(latestModuleDescriptor,
            resolveOptions);

        displayDependencyUpdates(getResolvedReport(), latestReport);
        if (showTransitive) {
            displayNewDependencyOnLatest(getResolvedReport(), latestReport);
            displayMissingDependencyOnLatest(getResolvedReport(), latestReport);
        }

    } catch (ParseException | IOException e) {
        throw new BuildException("impossible to resolve dependencies:\n\t" + e, e);
    }

}