Search in sources :

Example 1 with UnknownModelException

use of org.gradle.tooling.UnknownModelException in project gradle by gradle.

the class Exceptions method unsupportedModel.

public static UnknownModelException unsupportedModel(Class<?> modelType, String targetVersion) {
    ModelMapping modelMapping = new ModelMapping();
    String versionAdded = modelMapping.getVersionAdded(modelType);
    if (versionAdded != null) {
        return new UnknownModelException(String.format("The version of Gradle you are using (%s) does not support building a model of type '%s'. Support for building '%s' models was added in Gradle %s and is available in all later versions.", targetVersion, modelType.getSimpleName(), modelType.getSimpleName(), versionAdded));
    } else {
        return new UnknownModelException(String.format("The version of Gradle you are using (%s) does not support building a model of type '%s'. Support for building custom tooling models was added in Gradle 1.6 and is available in all later versions.", targetVersion, modelType.getSimpleName()));
    }
}
Also used : UnknownModelException(org.gradle.tooling.UnknownModelException) ModelMapping(org.gradle.tooling.internal.consumer.versioning.ModelMapping)

Aggregations

UnknownModelException (org.gradle.tooling.UnknownModelException)1 ModelMapping (org.gradle.tooling.internal.consumer.versioning.ModelMapping)1