<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Cannot deply gradle portlet with a external guava jar</title>
  <link rel="self" href="https://uat.liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=122553038" />
  <subtitle>Cannot deply gradle portlet with a external guava jar</subtitle>
  <id>https://uat.liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=122553038</id>
  <updated>2026-10-15T11:16:44Z</updated>
  <dc:date>2026-10-15T11:16:44Z</dc:date>
  <entry>
    <title>RE: Cannot deply gradle portlet with a external guava jar</title>
    <link rel="alternate" href="https://uat.liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122553282" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://uat.liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122553282</id>
    <updated>2024-04-17T12:12:59Z</updated>
    <published>2024-04-17T12:12:58Z</published>
    <summary type="html">&lt;p&gt;Gogo Shell can help you resolve this kind of problems. In this case,
  from the detail that you provide, it's probable that the dependency
  you've introduced &lt;em&gt;at compile time&lt;/em&gt; (google guava) is not
  available &lt;em&gt;at runtime&lt;/em&gt;. In case Guava is packaged as OSGi
  bundle, you'll need to drop the matching version into Liferay's deploy
  folder, to make it available to the runtime as well (you'll only need
  to do this once). I don't know if Guava has transitive
  runtime-dependencies: For them, the same would apply.&lt;/p&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2024-04-17T12:12:58Z</dc:date>
  </entry>
  <entry>
    <title>Cannot deply gradle portlet with a external guava jar</title>
    <link rel="alternate" href="https://uat.liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122553037" />
    <author>
      <name>Giannis Foufas</name>
    </author>
    <id>https://uat.liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122553037</id>
    <updated>2024-04-17T12:08:38Z</updated>
    <published>2024-04-17T11:14:57Z</published>
    <summary type="html">&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a service with gradle and I would  and I would like to add a
  guava cache functionallity into a Utility Class of the web:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;	private static LoadingCache&amp;lt;Long,List&amp;lt;JournalArticle&amp;gt;&amp;gt; listOrderedArticles =
				CacheBuilder.newBuilder()
						.expireAfterWrite(10,TimeUnit.MINUTES)
     					.build(
								new CacheLoader&amp;lt;Long, List&amp;lt;JournalArticle&amp;gt;&amp;gt;() {
									@Override
									public List&amp;lt;JournalArticle&amp;gt; load(Long aLong) throws Exception {
										return getListOfOrderedArticles(aLong.longValue());
									}
								}
						);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;
  &lt;br&gt; ​​​​​​​build.gradle:&lt;br&gt;
  &lt;br&gt; ​​​​​&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;dependencies {
	compileOnly group: &amp;quot;com.liferay.portal&amp;quot;, name: &amp;quot;release.portal.api&amp;quot;
	compileOnly project(&amp;quot;:my-service-api&amp;quot;)
	compileOnly group: &amp;quot;com.google.guava&amp;quot;, name:&amp;quot;guava&amp;quot;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;and with bnd.bnd:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;Bundle-Name: My-App Web
Bundle-SymbolicName: com.my.app.web
Bundle-Version: 1.0.0
Import-Package: com.google.common.cache&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The problem is that when ever I deploy the jar&lt;br&gt;  &lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;com.liferay.portal.kernel.log.LogSanitizerException: org.osgi.framework.BundleException: Could not resolve module: my.app.web [1662]_  Unresolved requirement: Import-Package: com.google.common.cache; version=&amp;quot;30.1.0&amp;quot;_ [Sanitized]
        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428) ~[org.eclipse.osgi.jar:?]
        at com.liferay.portal.file.install.internal.DirectoryWatcher._startBundle(DirectoryWatcher.java:1156) [bundleFile:?]
        at com.liferay.portal.file.install.internal.DirectoryWatcher._startBundles(DirectoryWatcher.java:1189) [bundleFile:?]
        at com.liferay.portal.file.install.internal.DirectoryWatcher._startAllBundles(DirectoryWatcher.java:1130) [bundleFile:?]
        at com.liferay.portal.file.install.internal.DirectoryWatcher._process(DirectoryWatcher.java:1041) [bundleFile:?]
        at com.liferay.portal.file.install.internal.DirectoryWatcher.run(DirectoryWatcher.java:221) [bundleFile:?]


&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;​​​​​​​&lt;br&gt; Could you please help?&lt;br&gt;
  &lt;br&gt;  &lt;/p&gt;</summary>
    <dc:creator>Giannis Foufas</dc:creator>
    <dc:date>2024-04-17T11:14:57Z</dc:date>
  </entry>
</feed>
