Recent Changes - Search:

edit SideBar

EclipseAndTycho

Notes about setting up Triquetrum to use Eclipse Tycho.

Problem

We want to set up the Triquetrum Git Repo to use Eclipse Tycho for so that we can build Triquetrum from the command line.

Generate pom.xml files

The Eclipse Tycho Tutorial at Vogella.com is suggests that we do:

  mvn org.eclipse.tycho:tycho-pomgenerator-plugin:generate-poms -DgroupId=triquetrum

This creates the pom.xml files

Dependency Problem

The tutorial suggests running:

  mvn clean verify 

The tutorial states:

"Tip: It is not recommended to use the mvn clean install command, instead you should use mvn clean verify. If you would use the install option, the build result would be installed in your local Maven repository and this can lead to build problems.

The tutorial states:

"Warning If you try to execute this POM file, the build fail because you have not yet configured your dependencies."
bash-3.2$ rm -rf ~/.m2/repository/triquetrum/
bash-3.2$ mvn clean verify
[INFO] Scanning for projects...
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[INFO] Computing target platform for MavenProject: triquetrum:org.eclipse.triquetrum.common:1.0.0-SNAPSHOT @ /Users/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.common/pom.xml
[INFO] Resolving dependencies of MavenProject: triquetrum:org.eclipse.triquetrum.common:1.0.0-SNAPSHOT @ /Users/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.common/pom.xml
[INFO] {osgi.os=macosx, osgi.ws=cocoa, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.eclipse.triquetrum.common 1.0.0.qualifier
[ERROR]   Missing requirement: org.eclipse.triquetrum.common 1.0.0.qualifier requires 'package ptolemy.data 10.1.0' but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: triquetrum:org.eclipse.triquetrum.common:1.0.0-SNAPSHOT @ /Users/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.common/pom.xml: See log for details -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
bash-3.2$

The org.eclipse.triquetrum.target.platform/target/plugins/ptolemy.core_11.0.0.201511291558.jar file has a META-INF/MANIFEST.MF that exports the ptolemy.data package.

So, we need to add these dependencies.

POM-less Tycho builds

Further reading finds POM-less Tycho builds.

Be sure that you have mvn 3.3 or later installed.

To use it, create .mvn/extensions.xml

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
  <extension>
    <groupId>org.eclipse.tycho.extras</groupId>
    <artifactId>tycho-pomless</artifactId>
    <version>0.24.0</version>
  </extension>
</extensions>

Then remove the */pom.xml files.

Note that we have a pom.xml file that was created by Generate pom.xml files above.

Running mvn clean results in the same problem as above where we are depending on ptolemy.data.

More on the dependency Problem

Tycho Target Platform

  • Tycho Target Platform (Eclipse Wiki)
    • In Eclipse, the triq.target has a definitions tab that lists the location of the ptII jar files:

Attach:TriqTargetDefinitions.png Δ

triquetrumDeps

Jay Jay Billings suggested using something similar to https://github.com/jayjaybillings/ICEDeps

I've created https://github.com/cxbrooks/triquetrumDeps

To use it, be sure that you have mvn 3.3 or later installed, which is needed by POM-less Tycho builds. To check, run

  mvn --version
git clone -b cxbrooks/eh/10/AddPom https://github.com/eclipse/triquetrum
git clone https://github.com/cxbrooks/triquetrumDeps
cd triquetrum
mvn -N install
mvn install

Child module ... does not exist

If you get this:

cxh@terra triquetrum]$ mvn install
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project triquetrum:org.eclipse.triquetrum.build:0.0.1-SNAPSHOT (/home/cxh/src/triquetrum/triquetrum/pom.xml) has 14 errors
[ERROR]     Child module /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.common/pom.xml of /home/cxh/src/triquetrum/triquetrum/pom.xml does not exist
[ERROR]     Child module /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.logging.dvp/pom.xml of /home/cxh/src/triquetrum/triquetrum/pom.xml does not exist
[ERROR]     Child module /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.processing.api/pom.xml of /home/cxh/src/triquetrum/triquetrum/pom.xml does not exist
...

Then you need to upgrade maven to maven 3.3 or later.

bundle org.apache.log4j 1.2.15 could not be found

mvn install fails with:

[INFO] Resolving dependencies of MavenProject: triquetrum:org.eclipse.triquetrum.logging.dvp:1.0.0-SNAPSHOT @ /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.logging.dvp/.polyglot.build.properties
[INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.eclipse.triquetrum.logging.dvp 1.0.0.qualifier
[ERROR]   Missing requirement: org.eclipse.triquetrum.logging.dvp 1.0.0.qualifier requires 'bundle org.apache.log4j 1.2.15' but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: triquetrum:org.eclipse.triquetrum.logging.dvp:1.0.0-SNAPSHOT @ /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.logging.dvp/.polyglot.build.properties: See log for details -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
[cxh@terra triquetrum]$

Indeed, ./org.eclipse.triquetrum.logging.dvp/META-INF/MANIFEST.MF contains:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Dvp logging config
Bundle-SymbolicName: org.eclipse.triquetrum.logging.dvp
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.apache.log4j;bundle-version="1.2.15"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

http://wiki.osgi.org/wiki/Fragment-Host says

"Declares this bundle to be a Fragment, and specifies which parent bundle to attach to:
Fragment-Host: the.parent.bundle
May also have an optional version constraint:
Fragment-Host: the.parent.bundle;bundle-version=1.2.3

See 1 Understanding missing requirement messages (Eclipse Wiki)

Solution! Add the following to pom.xml:

  <repositories>
    <repository>
      <id>eclipse-indigo</id>
      <url>http://archive.eclipse.org/tools/orbit/downloads/drops/R20100519200754/repository</url>
      <layout>p2</layout>
    </repository>
  </repositories>

See

"For HTTP access, a p2 repository for this specific build can be found by adding 'repository' to the end of this download site URL, namely:

http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"

Missing requirement: org.eclipse.triquetrum.workflow.actor.ui 1.0.0.qualifier requires 'bundle ptolemy.actor.lib.gui 11.0.0

[INFO] Resolving dependencies of MavenProject: triquetrum:org.eclipse.triquetrum.workflow.actor.ui:1.0.0-SNAPSHOT @ /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.workflow.actor.ui/.polyglot.build.properties
[INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.eclipse.triquetrum.workflow.actor.ui 1.0.0.qualifier
[ERROR] Missing requirement: org.eclipse.triquetrum.workflow.actor.ui 1.0.0.qualifier requires 'bundle ptolemy.actor.lib.gui 11.0.0' but it could not be found

The fix was to edit triquetrum/org.eclipse.triquetrum.workflow.actor.ui/META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Actor UI integration
Bundle-SymbolicName: org.eclipse.triquetrum.workflow.actor.ui
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.swt,
 org.eclipse.swt.graphics,
 org.eclipse.swt.layout,
 org.eclipse.swt.widgets,
 org.osgi.framework;version="1.8.0"
Bundle-Activator: org.eclipse.triquetrum.workflow.actor.ui.activator.Activator
Require-Bundle: ptolemy.actor.lib.gui;bundle-version="11.0.0",
 ptolemy.core;bundle-version="11.0.0",
 ptolemy.gui;bundle-version="11.0.0",
 org.eclipse.triquetrum.workflow.ui;bundle-version="1.0.0"

to

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Actor UI integration
Bundle-SymbolicName: org.eclipse.triquetrum.workflow.actor.ui
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.swt,
 org.eclipse.swt.graphics,
 org.eclipse.swt.layout,
 org.eclipse.swt.widgets,
 org.osgi.framework;version="1.8.0",
 org.eclipse.triquetrum.dependencies
Bundle-Activator: org.eclipse.triquetrum.workflow.actor.ui.activator.Activator
Require-Bundle: org.eclipse.triquetrum.workflow.ui;bundle-version="1.0.0"

requires 'package org.eclipse.swt 0.0.0'

[INFO] Computing target platform for MavenProject: triquetrum:org.eclipse.triquetrum.workflow.actor.ui:1.0.0-SNAPSHOT @ /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.workflow.actor.ui/.polyglot.build.properties
[INFO] Resolving dependencies of MavenProject: triquetrum:org.eclipse.triquetrum.workflow.actor.ui:1.0.0-SNAPSHOT @ /home/cxh/src/triquetrum/triquetrum/org.eclipse.triquetrum.workflow.actor.ui/.polyglot.build.properties
[INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.eclipse.triquetrum.workflow.actor.ui 1.0.0.qualifier
[ERROR]   Missing requirement: org.eclipse.triquetrum.workflow.actor.ui 1.0.0.qualifier requires 'package org.eclipse.swt 0.0.0' but it could not be found

The fix here was to updated the <repositories> section of triquetrum/pom.xml:

  <repositories>                                                                                                                    
    <repository>
      <id>eclipse-mars</id>
      <layout>p2</layout>
      <url>http://download.eclipse.org/releases/mars</url>
    </repository>                                                                                                                  
    <repository>
      <id>eclipse-indigo</id>
      <url>http://archive.eclipse.org/tools/orbit/downloads/drops/R20100519200754/repository</url>
      <layout>p2</layout>
    </repository>
  </repositories>

org.eclipse.triquetrum.dependencies

Added eclipse-mars means:

Missing requirement: org.eclipse.triquetrum.workflow.actor.ui 1.0.0.qualifier requires 'package org.eclipse.triquetrum.dependencies 0.0.0' but it could not be found

Here, the fix was to edit triquetrum/org.eclipse.triquetrum.workflow.actor.ui/META-INF/MANIFEST.MF and move org.eclipse.triquetrum.dependencies from Import-Package to Require-Bundle

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Actor UI integration
Bundle-SymbolicName: org.eclipse.triquetrum.workflow.actor.ui
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.swt,
org.eclipse.swt.graphics,
org.eclipse.swt.layout,
org.eclipse.swt.widgets,
org.osgi.framework;version="1.8.0"
Bundle-Activator: org.eclipse.triquetrum.workflow.actor.ui.activator.Activator
Require-Bundle: org.eclipse.triquetrum.workflow.ui;bundle-version="1.0.0",
org.eclipse.triquetrum.dependencies

OSGi version 0.0.1.2016011812000 must have .qualifier qualifier for SNAPSHOT builds

Next up:

  [ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.24.0:validate-version (default-validate-version) on project org.eclipse.triquetrum.dependencies: OSGi version 0.0.1.2016011812000 must have .qualifier qualifier for SNAPSHOT builds -> [Help 1]

Solution: Edit triquetrumDeps/org.eclipse.triquetrum.dependencies/META-INF/MANIFEST.MF and change

  Bundle-Version: 0.0.1.2016011812000

to

  Bundle-Version: 0.0.1.qualifier

The constructor PtolemyModule(ClassLoader, ResourceBundle) is undefined

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (default-compile) on project org.eclipse.triquetrum.workflow.actor.ui: Compilation failure: Compilation failure:
[ERROR] /Users/cxh/git/triquetrum/org.eclipse.triquetrum.workflow.actor.ui/src/main/java/org/eclipse/triquetrum/workflow/actor/ui/activator/Activator.java:[25]
[ERROR] PtolemyInjector.createInjector(new PtolemyModule(getClass().getClassLoader(), ResourceBundle.getBundle("org.eclipse.triquetrum.workflow.actor.ui.ActorModule")));
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PtolemyModule(ClassLoader, ResourceBundle) is undefined

It looks like $PTII/ptolemy/actor/injections/PtolemyInjector.java does not have this constructor.

bash-3.2$ javap -classpath triquetrumDeps/org.eclipse.triquetrum.dependencies/deps/ptII/ptolemy.gui_11.0.0.201511291558.jar ptolemy.actor.injection.PtolemyModule
Compiled from "PtolemyModule.java"
public class ptolemy.actor.injection.PtolemyModule {
  public ptolemy.actor.injection.PtolemyModule(java.util.ResourceBundle);
  public java.util.HashMap<java.lang.String, java.lang.String> getBindings();
}
bash-3.2$

osgi-2-0 build works under Linux, fails under MacOSX

Under Linux mvn verify works fine. Under MacOSX, it does not.

Under Linux

/home/cxh/src/triq/osgi-2-0
cxh@swarmnuc2008:~/src/triq/osgi-2-0$ find ~/.m2 -name "*junit.framework*"
cxh@swarmnuc2008:~/src/triq/osgi-2-0$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
cxh@swarmnuc2008:~/src/triq/osgi-2-0$ mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-154-generic", arch: "amd64", family: "unix"
cxh@swarmnuc2008:~/src/triq/osgi-2-0$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
cxh@swarmnuc2008:~/src/triq/osgi-2-0$

Under MacOSX:

bash-3.2$ mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T15:00:29-04:00)
Maven home: /opt/local/share/java/maven3
Java version: 1.8.0_171, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.4", arch: "x86_64", family: "mac"
bash-3.2$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
bash-3.2$

After upgrading Linux to mvn 3.6.1:

wget http://ftp.wayne.edu/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.zip
unzip apache-maven-3.6.1-bin.zip
export PATH=/home/cxh/src/triq/osgi-2-0/apache-maven-3.6.1/bin:${PATH}

Then I get the same problem!

Solution: Downgrade MacOS to 3.3.9.

See: Bug 545872 - Tycho fails to resolve on latest maven snapshot builds (3.6.1-SNAPSHOT ~0be26449fb96774be126a6ad245d1a98dc71907c) which says to downgrade to 3.6.0

Access restriction: The type 'Unsafe' is not API

mvn clean verify fails with:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project ptolemy.core: Compilation\
failure: Compilation failure:
[ERROR] /Users/cxh/src/triq/osgi-2-0/ptolemy.core/original-src/ptolemy/util/StringUtilities.java:[48]
[ERROR] import sun.misc.Unsafe;
[ERROR] ^^^^^^^^^^^^^^^
[ERROR] Access restriction: The type 'Unsafe' is not API (restriction on classpath entry '/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jd\
k/Contents/Home/jre/lib/rt.jar')
[ERROR] /Users/cxh/src/triq/osgi-2-0/ptolemy.core/original-src/ptolemy/util/StringUtilities.java:[118]
[ERROR] Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
[ERROR] ^^^^^^
[ERROR] Access restriction: The type 'Unsafe' is not API (restriction on classpath entry '/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jd\
k/Contents/Home/jre/lib/rt.jar')
[ERROR] /Users/cxh/src/triq/osgi-2-0/ptolemy.core/original-src/ptolemy/util/StringUtilities.java:[120]
[ERROR] Unsafe unsafe = (Unsafe) theUnsafe.get(null);
[ERROR] ^^^^^^

However, the same code builds fine inside Eclipse. The failure is in mvn

I updated the references from Java 1.7 to Java 1.8, but that did not help.

“API restriction error” when exporting Eclipse plugin with maven-tycho suggests adding <useProjectSettings>false</useProjectSettings>:

        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-compiler-plugin</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
                <useProjectSettings>false</useProjectSettings>
            </configuration>
        </plugin>
Edit - History - Print - Recent Changes - Search
Page last modified on August 09, 2019, at 11:28 AM