Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Triquetrum/Ptolemy/osgi-2-0"
(Added a target.) |
(Working on p2) |
||
Line 267: | Line 267: | ||
</pre> | </pre> | ||
Clearly, the artifactId would need to be changed. | Clearly, the artifactId would need to be changed. | ||
+ | |||
+ | ==== Setting up the p2 repository ==== | ||
+ | We want to create a p2 repository for these files. | ||
+ | |||
+ | Add the following to osgi-2-0/pom.xml: | ||
+ | <pre> | ||
+ | <plugin> | ||
+ | <groupId>org.eclipse.tycho</groupId> | ||
+ | <artifactId>tycho-p2-repository-plugin</artifactId> | ||
+ | <version>${tycho-version}</version> | ||
+ | <configuration> | ||
+ | <includeAllDependencies>true</includeAllDependencies> | ||
+ | </configuration> | ||
+ | </plugin> | ||
+ | </pre> |
Revision as of 09:46, 29 June 2016
This page is notes about how the Ptolemy II osgi-2-0 repository that contains the Ptolemy II sources used by Triquetrum was set up. It is probably not that useful to most people.
Contents
See Also
- Ptolemy/Porting - more user friendly instructions about how to port Ptolemy actors to Triquetrum
- Ptolemy II osgi-2-0 Jenkins build
Setting up a nightly build
We would like to set up a nightly build, so we want to run Maven, create jar files and make them available somehow.
See Check out the ptII osgi-2-0 branch for getting access to the Ptolemy II osgi-2-0 repository
Creating pom files
POM-less Tycho Builds suggests creating osgi-2-0/.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>
The Eclipse Tycho Tutorial suggests:
cd osgi-2-0 mvn org.eclipse.tycho:tycho-pomgenerator-plugin:generate-poms -DgroupId=ptolemy
This creates osgi-2-0/pom.xml and other */pom.xml files.
We then remove the */pom.xml files that were created:
rm */pom.xml
Running mvn
The Eclipse Tycho 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."
mvn clean fails
If we run
mvn clean
we get
[ERROR] Cannot resolve project dependencies: [ERROR] Software being installed: diva 11.0.0.qualifier [ERROR] Missing requirement: diva 11.0.0.qualifier requires 'package org.w3c.dom.svg 1.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: ptolemy:diva:11.0.0-SNAPSHOT @ /Users/cxh/src/osgi-2-0/diva/.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
So the next step is to fix the dependencies.
Fixing a dependency problem
Looking at Understanding Missing Requirement Messages and Using p2 update sites for dependencies resolutionUsing p2 update sites for dependencies resolution, the solution is to add the following to the osgi-2-0/pom.xml file:
<repositories> <repository> <id>eclipse-mars</id> <url>http://download.eclipse.org/releases/mars</url> <layout>p2</layout> </repository> </repositories>
After that
mvn clean
works
mvn verify fails
However,
mvn verify
fails:
[INFO] Building diva 11.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.w3c.dom.svg:svg-dom-java:jar:1.1.0 is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] osgi-2-0 ........................................... SUCCESS [ 0.002 s] [INFO] diva ............................................... FAILURE [ 0.058 s] [INFO] org.ptolemy.testsupport ............................ SKIPPED [INFO] org.ptolemy.commons ................................ SKIPPED [INFO] ptolemy.core ....................................... SKIPPED [INFO] ptolemy.moml ....................................... SKIPPED [INFO] ptolemy.actor.lib .................................. SKIPPED [INFO] ptolemy.domains.sdf ................................ SKIPPED [INFO] org.ptolemy.actor.gui.test ......................... SKIPPED [INFO] ptolemy.domains.process ............................ SKIPPED [INFO] org.ptolemy.core.test .............................. SKIPPED [INFO] org.ptolemy.core.test.actor ........................ SKIPPED [INFO] ptolemy.actor.lib.gui .............................. SKIPPED [INFO] ptolemy.gui ........................................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.218 s [INFO] Finished at: 2016-06-28T16:32:25-07:00 [INFO] Final Memory: 92M/504M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project diva: Could not resolve dependencies for project ptolemy:diva:eclipse-plugin:11.0.0-SNAPSHOT: Failure to find org.w3c.dom.svg:svg-dom-java:jar:1.1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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/DependencyResolutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :diva
The fix was to remove the following from osgi-2-0/pom.xml:
<dependencies> <!-- https://mvnrepository.com/artifact/org.axsl.org.w3c.dom.svg/svg-dom-java --> <dependency> <groupId>org.w3c.dom.svg</groupId> <artifactId>svg-dom-java</artifactId> <version>1.1.0</version> </dependency> </dependencies>
mvn verify fails because of GenerateHTMLTest
Running
mvn verify
fails:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile ( default-compile) on project org.ptolemy.actor.gui.test: Compilation failure: Compilation failure: [ERROR] /Users/cxh/src/osgi-2-0/org.ptolemy.actor.gui.test/src/test/java/org/ptolemy/actor/gui/test/GenerateHTMLTest.java:[39] [ERROR] import ptolemy.actor.gui.GenerateCopyrights; [ERROR] ^^^^^^^^^^^^^^^^^ [ERROR] The import ptolemy.actor.gui cannot be resolved [ERROR] /Users/cxh/src/osgi-2-0/org.ptolemy.actor.gui.test/src/test/java/org/ptolemy/actor/gui/test/GenerateHTMLTest.java:[59] [ERROR] System.out.println(GenerateCopyrights.generateHTML(null)); [ERROR] ^^^^^^^^^^^^^^^^^^ [ERROR] GenerateCopyrights cannot be resolved [ERROR] 2 problems (2 errors)
A workaround:
rm org.ptolemy.actor.gui.test/src/test/java/org/ptolemy/actor/gui/test/GenerateHTMLTest.java
However it seems like we don't have the dependencies properly set up.
Editing osgi-2-0/org.ptolemy.actor.gui.test/META-INF/MANIFEST.MF and adding a trailing comma and
ptolemy.gui;bundle-version="10.1.0"
so that we have
Require-Bundle: org.ptolemy.testsupport;bundle-version="10.1.0", ptolemy.core;bundle-version="10.1.0", ptolemy.actor.lib;bundle-version="10.1.0", ptolemy.domains.sdf;bundle-version="10.1.0", ptolemy.gui;bundle-version="10.1.0"
IconAttribute
Running:
mvn verify
fails with:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile ( default-compile) on project ptolemy.gui: Compilation failure: Compilation failure: [ERROR] /Users/cxh/src/osgi-2-0/ptolemy.gui/src/ptolemy/vergil/icon/EditorIcon.java:[52] [ERROR] import ptolemy.kernel.util.IconAttribute; [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] Access restriction: The type 'IconAttribute' is not API (restriction on classpath entry '/Users/cxh/src/osgi-2-0/ptolemy.core/target/classes')
Access restriction on class due to restriction on required library rt.jar? (Stackoverflow) refers to What is the latest on "Access restriction" compilation errors, which suggests adding:
<plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-compiler-plugin</artifactId> <version>${tycho.version}</version> <configuration> <compilerArgument>-warn:+discouraged,forbidden</compilerArgument> </configuration> </plugin>
The ${tycho.version} was causing problems, so at the top of pom.xml we added:
<properties> <target-version>0.1.0-SNAPSHOT</target-version> <tycho-version>0.24.0</tycho-version> </properties>
and then added the following to the plugins section
<!-- See http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03670.html --> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-compiler-plugin</artifactId> <version>${tycho-version}</version> <configuration> <compilerArgument>-warn:+discouraged,forbidden</compilerArgument> </configuration> </plugin>
Now
mvn verify
works!
No explicit target runtime environment configuration
Running
mvn verify
produces
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
So we add the following:
<!-- This configures the target platform and the supported architectures. --> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho-version}</version> <configuration> <environments> <environment> <os>linux</os> <ws>gtk</ws> <arch>x86</arch> </environment> <environment> <os>linux</os> <ws>gtk</ws> <arch>x86_64</arch> </environment> <environment> <os>win32</os> <ws>win32</ws> <arch>x86</arch> </environment> <environment> <os>win32</os> <ws>win32</ws> <arch>x86_64</arch> </environment> <environment> <os>macosx</os> <ws>cocoa</ws> <arch>x86_64</arch> </environment> </environments> </configuration> </plugin>
See the triquetrum pom.xml for an additional target section that could go in this plugin:
<target> <artifact> <groupId>triquetrum</groupId> <artifactId>org.eclipse.triquetrum.target.platform</artifactId> <version>0.1.0-SNAPSHOT</version> </artifact> </target>
Clearly, the artifactId would need to be changed.
Setting up the p2 repository
We want to create a p2 repository for these files.
Add the following to osgi-2-0/pom.xml:
<plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-p2-repository-plugin</artifactId> <version>${tycho-version}</version> <configuration> <includeAllDependencies>true</includeAllDependencies> </configuration> </plugin>