Search in sources :

Example 1 with AppArtifactCoords

use of io.quarkus.bootstrap.model.AppArtifactCoords in project quarkus by quarkusio.

the class ExtensionDescriptorMojo method ensureArtifactCoords.

private void ensureArtifactCoords(ObjectNode extObject) {
    String groupId = null;
    String artifactId = null;
    String version = null;
    final JsonNode artifactNode = extObject.get("artifact");
    if (artifactNode == null) {
        groupId = getRealValueOrNull(extObject.has("groupId") ? extObject.get("groupId").asText() : null, "${project.groupId");
        artifactId = getRealValueOrNull(extObject.has("artifactId") ? extObject.get("artifactId").asText() : null, "${project.artifactId");
        version = getRealValueOrNull(extObject.has("version") ? extObject.get("version").asText() : null, "${project.version");
    } else {
        final String[] coordsArr = artifactNode.asText().split(":");
        if (coordsArr.length > 0) {
            groupId = getRealValueOrNull(coordsArr[0], "${project.groupId}");
            if (coordsArr.length > 1) {
                artifactId = getRealValueOrNull(coordsArr[1], "${project.artifactId}");
                if (coordsArr.length > 2) {
                    version = getRealValueOrNull(coordsArr[2], "${project.version}");
                }
            }
        }
    }
    if (artifactNode == null || groupId == null || artifactId == null || version == null) {
        final AppArtifactCoords coords = new AppArtifactCoords(groupId == null ? project.getGroupId() : groupId, artifactId == null ? project.getArtifactId() : artifactId, null, "jar", version == null ? project.getVersion() : version);
        extObject.put("artifact", coords.toString());
    }
}
Also used : AppArtifactCoords(io.quarkus.bootstrap.model.AppArtifactCoords) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Example 2 with AppArtifactCoords

use of io.quarkus.bootstrap.model.AppArtifactCoords in project quarkus by quarkusio.

the class ExtensionDescriptorTask method computeArtifactCoords.

private void computeArtifactCoords(ObjectNode extObject) {
    String groupId = null;
    String artifactId = null;
    String version = null;
    final JsonNode artifactNode = extObject.get("artifact");
    if (artifactNode == null) {
        groupId = extObject.has("groupId") ? extObject.get("groupId").asText() : null;
        artifactId = extObject.has("artifactId") ? extObject.get("artifactId").asText() : null;
        version = extObject.has("version") ? extObject.get("version").asText() : null;
    } else {
        final String[] coordsArr = artifactNode.asText().split(":");
        if (coordsArr.length > 0) {
            groupId = coordsArr[0];
            if (coordsArr.length > 1) {
                artifactId = coordsArr[1];
                if (coordsArr.length > 2) {
                    version = coordsArr[2];
                }
            }
        }
    }
    if (artifactNode == null || groupId == null || artifactId == null || version == null) {
        final AppArtifactCoords coords = new AppArtifactCoords(groupId == null ? getProject().getGroup().toString() : groupId, artifactId == null ? getProject().getName() : artifactId, null, "jar", version == null ? getProject().getVersion().toString() : version);
        extObject.put("artifact", coords.toString());
    }
}
Also used : AppArtifactCoords(io.quarkus.bootstrap.model.AppArtifactCoords) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)2 AppArtifactCoords (io.quarkus.bootstrap.model.AppArtifactCoords)2