Java 1.8 to 12

16 views
Skip to first unread message

Alexey

unread,
Jan 27, 2021, 6:16:54 AMJan 27
to cytoscape-app-dev
I have an external jar file that only works successfully on Java 12. In Cytoscape, I work with JDK 13, but  <Target bytecode version> =1.8 in Java Compiler settings .

Now in pom.xml:
 
<version>3.0</version>
...
<source>1.8</source>
<target>1.8</target> 

I replaced with:
 
<version>3.8.1</version>
...
<release>12</release>

This causes a error.
I don't know much about maven and I want to understand what I'm doing wrong. Thank you!

Alexey

unread,
Jan 27, 2021, 11:34:58 AMJan 27
to cytoscape-app-dev
Probably I formulated the question too incorrectly. I'll try a simpler task. I created a simple jar file that contains only two classes and included it in dependencies:
<dependency>
<groupId>dp.stud.code</groupId>
<artifactId>deptest</artifactId>
<version>1.0</version>
</dependency>

I can use classes from this jar-dependency for example in the CyActivator class. I am building the plugin and I am not getting any errors, however such a plugin does not work in cytoscape. 
Then I added this line to pom.xml : <Embed-Dependency>groupId=dp.stud.code</Embed-Dependency>. But nothing works.
среда, 27 января 2021 г. в 18:16:54 UTC+7, Alexey:

Scooter Morris

unread,
Jan 28, 2021, 11:33:13 AMJan 28
to cytoscape-app-dev
Hi Alexi,
    First, I think you would be better off targeting Java 11, which is required by Cytoscape 3.8.  Second, as far as what you need in maven to include the dependency, take a look at the clusterMaker2 pom.xml file, which includes a number of external dependencies.  You can find it here: https://github.com/RBVI/clusterMaker2/blob/master/pom.xml.  Look for some of the jung includes as an example.  Note that I had to install those packages in my local maven archive by doing mvn install.

-- scooter

Scooter Morris

unread,
Jan 28, 2021, 11:34:20 AMJan 28
to cytoscape-app-dev
Actually, I would also note David's response to Lauren.

-- scooter

Alexey

unread,
Jan 29, 2021, 3:14:11 AMJan 29
to cytoscape-app-dev
Thanks! I add my test jar-file to the project and everything works. But now when I install the third party jar file in the same way the plugin doesn't work. 

In Cytoscape\output.txt:
karaf.base: D:\Cytoscape_v3.8.2\framework
JAVA_HOME: C:\Program Files\AdoptOpenJDK\jdk-11.0.7.10-hotspot
org.cytoscape.app.internal.exception.AppStartupException: Bundle start error
at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:84) ~[?:?]
at org.cytoscape.app.internal.manager.AppManager.startApps(AppManager.java:404) ~[?:?]
at org.cytoscape.app.internal.manager.AppManager.initializeApps(AppManager.java:374) ~[?:?]
at org.cytoscape.app.internal.manager.AppManager.lambda$attemptInitialization$0(AppManager.java:235) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.osgi.framework.BundleException: Unable to resolve org.cytoscape.boolean_network [122](R 122.0): missing requirement [org.cytoscape.boolean_network [122](R 122.0)] osgi.wiring.package; (osgi.wiring.package=net.sf.tweety.logics.pl.syntax) Unresolved requirements: [[org.cytoscape.boolean_network [122](R 122.0)] osgi.wiring.package; (osgi.wiring.package=net.sf.tweety.logics.pl.syntax)]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2119) ~[?:?]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:82) ~[?:?]
... 8 more

If I understand correctly, it says here that net.sf.tweety.logics.pl.syntax is missing, but this package is already inside net.sf.tweety.tweety-full. 

in pom.xml :
<Embed-Dependency>tweety-full</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>

<dependency>
<groupId>net.sf.tweety</groupId>
<artifactId>tweety-full</artifactId>
<version>1.17</version>
</dependency>





четверг, 28 января 2021 г. в 23:34:20 UTC+7, Scooter Morris:

Scooter Morris

unread,
Feb 4, 2021, 11:37:49 AMFeb 4
to cytoscape-app-dev
Hi Alexey,
   Looks like it isn't getting properly embedded.  Here is a snippet of my pom.xml where I do embed lots of dependencies:

         <instructions>
            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Export-Package>!${bundle.namespace}.*</Export-Package>
            <Private-Package>${bundle.namespace}.*,com.jujutsu.*</Private-Package>
            <Bundle-Activator>${bundle.namespace}.CyActivator</Bundle-Activator>
            <Embed-Dependency>*;scope=!provided</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Import-Package>*;resolution:=optional</Import-Package>
          </instructions>

and then in the dependency itself:
    <dependency>
      <groupId>org.ojalgo</groupId>
      <artifactId>ojalgo</artifactId>
      <version>45.1.0</version>
      <optional>true</optional>
    </dependency>

note the "<optional>true</optional>".  That seems to work for me (although I honestly don't know why this particular piece of arcana is necessary).

-- scooter
Reply all
Reply to author
Forward
0 new messages