Hello, what happens is that I have a component and this has a sling model java, my idea is that I make a request with a url and I bring me the title of the page and save it in a getter, the code would be as follows:
public String getRecipeTitle() {
String pageLink = "PAGE LINK";
String titlePage = "";
try {
// Fetch the webpage content
Document doc = Jsoup.connect(pageLink).get();
// Extract the title
Element titleElement = doc.select("title").first();
if (titleElement != null) {
titlePage = titleElement.text();
} else {
titlePage = "Title not found";
}
} catch (Exception e) {
e.printStackTrace();
titlePage = "Error fetching title";
}
return titlePage;
}
And I use jsoup package to make this code, I install this package in the path: core/pom.xml adding this into the pom.xml file:
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.16.2</version>
</dependency>
But when I build the project it throws me the error:
Bundle aem-develop-project.core:0.0.1-SNAPSHOT is importing package(s) [org.jsoup, org.jsoup.nodes, org.jsoup.select] in start level 20 but no
bundle is exporting these for that start level. (com.tfs:aem-develop-project.all:0.0.1-SNAPSHOT)
How can I fix this error? I only need to download the package of jsoup via Maven, I even try different solutions but it still not working