dependency : dependencies) {
+ String[] dependencyParts = dependency.get("moduleName").split(":");
+ if (dependencyParts.length != 2) {
+ throw new SolicitorRuntimeException(
+ "Could not extract groupId, artifactId from moduleName: '" + dependency.get("moduleName") + "'");
+ }
+
+ ApplicationComponent appComponent = getModelFactory().newApplicationComponent();
+ appComponent.setApplication(application);
+ appComponent.setGroupId(dependencyParts[0]);
+ appComponent.setArtifactId(dependencyParts[1]);
+ appComponent.setVersion(dependency.get("moduleVersion"));
+
+ // Extract the first element from moduleUrls if available
+ Object urlsObject = dependency.get("moduleUrls");
+ if (urlsObject instanceof List>) {
+ List> urlsList = (List>) urlsObject;
+ if (!urlsList.isEmpty() && urlsList.get(0) instanceof String) {
+ appComponent.setOssHomepage((String) urlsList.get(0));
+ }
+ }
+
+ appComponent.setUsagePattern(usagePattern);
+ appComponent.setRepoType(repoType);
+ appComponent.setPackageUrl(PackageURLHelper
+ .fromMavenCoordinates(dependencyParts[0], dependencyParts[1], dependency.get("moduleVersion")).toString());
+
+ // Extract and process moduleLicenses
+ Object licensesObject = dependency.get("moduleLicenses");
+ if (licensesObject instanceof List>) {
+ List> licensesList = (List>) licensesObject;
+ for (Object licenseObject : licensesList) {
+ if (licenseObject instanceof Map, ?>) {
+ Map, ?> licenseMap = (Map, ?>) licenseObject;
+ String licenseName = (String) licenseMap.get("moduleLicense");
+ String licenseUrl = (String) licenseMap.get("moduleLicenseUrl");
+ addRawLicense(appComponent, licenseName, licenseUrl, sourceUrl);
+ }
+ }
+ }
+
+ components++;
+ licenses++;
+ }
+
+ doLogging(sourceUrl, application, components, licenses);
+
+ } catch (IOException e) {
+ throw new SolicitorRuntimeException("Could not read Gradle License Report inventory source '" + sourceUrl + "'",
+ e);
+ }
+ }
+
+}
diff --git a/core/src/main/java/com/devonfw/tools/solicitor/reader/gradle/GradleReader.java b/core/src/main/java/com/devonfw/tools/solicitor/reader/gradle/GradleReader.java
deleted file mode 100644
index f1d910c4..00000000
--- a/core/src/main/java/com/devonfw/tools/solicitor/reader/gradle/GradleReader.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package com.devonfw.tools.solicitor.reader.gradle;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import com.devonfw.tools.solicitor.common.DeprecationChecker;
-import com.devonfw.tools.solicitor.common.PackageURLHelper;
-import com.devonfw.tools.solicitor.common.SolicitorRuntimeException;
-import com.devonfw.tools.solicitor.model.inventory.ApplicationComponent;
-import com.devonfw.tools.solicitor.model.masterdata.Application;
-import com.devonfw.tools.solicitor.model.masterdata.UsagePattern;
-import com.devonfw.tools.solicitor.reader.AbstractReader;
-import com.devonfw.tools.solicitor.reader.Reader;
-import com.devonfw.tools.solicitor.reader.gradle.model.Dependency;
-import com.devonfw.tools.solicitor.reader.gradle.model.License;
-import com.devonfw.tools.solicitor.reader.gradle.model.LicenseSummary;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-/**
- * A {@link Reader} which reads data generated by the
- * Gradle License Plugin.
- *
- * The data mapping used by this class is inconsistent to the MavenReader. This class is only provided for backward
- * compatibility. Use {@link GradleReader2} instead.
- */
-@Component
-public class GradleReader extends AbstractReader implements Reader {
-
- /**
- * The supported type of this {@link Reader}.
- */
- public static final String SUPPORTED_TYPE = "gradle";
-
- private DeprecationChecker deprecationChecker;
-
- @Autowired
- public void setDeprecationChecker(DeprecationChecker deprecationChecker) {
-
- this.deprecationChecker = deprecationChecker;
- }
-
- /** {@inheritDoc} */
- @Override
- public Set getSupportedTypes() {
-
- return Collections.singleton(SUPPORTED_TYPE);
- }
-
- /** {@inheritDoc} */
- @Override
- public void readInventory(String type, String sourceUrl, Application application, UsagePattern usagePattern,
- String repoType, String packageType, Map configuration) {
-
- this.deprecationChecker.check(false,
- "Use of Reader of type 'gradle' is deprecated, use 'gradle2' instead. See https://github.com/devonfw/solicitor/issues/58");
- int components = 0;
- int licenses = 0;
- LicenseSummary ls = new LicenseSummary();
- ls.setDependencies(new LinkedList());
-
- // According to tutorial https://github.com/FasterXML/jackson-databind/
- ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
- try {
- List