Build Fesa3 Eclipse Plugin with Maven


SVN Repository URL

Codebase for Eclipse Neon: https://www-acc.gsi.de/svn/fesa/framework/trunk/plugin/neon

The codebase consists of the following projects (order from top to bottom mirrors the dependencies):
Project Name Description
jlibs Adapted version of jlibs (https://code.google.com/p/jlibs/), collection of useful classes to work with XML documents etc
fesa-plugin-utils FESA specific utilities
fesa-plugin-model Common description of the FESA metamodel for classes, deploy-units, instantiation documents
fesa-plugin-model-gsi Specific extension of the FESA metamodel
fesa-plugin-control Common control part
fesa-plugin-control-gsi Specific control part: build, creation, database, delivery, repository, etc integration
fesa-plugin-codegen-gsi Adapted code generation of the FESA plug-in
fesa-plugin-ui Common part of the UI integration of the FESA Eclipse plug-in
fesa-plugin-ui-gsi Specific part for extension of the common UI part, hosts e.g. the cheat sheets, plug-in spring application context description, etc
fesa-plugin-feature Contains the Eclipse plug-in feature definition
fesa-plugin-update-site Wraps the Eclipse plug-in feature, provides the update site description
releng/de.gsi.fesa.plugin.configuration Contains the configuration of the Eclipse plug-in and its libraries (version numbers etc.)
Each project has its maven pom.xml file. The configuration is stored in releng/de.gsi.fesa.plugin.configuration/ (since Eclipse Neon on CentOS 7). The configuration contains version numbers of certain libraries used.

Important: Once the version of the FESA Eclipse plug-in is increased the plug-in's configuration must be deployed with a new version into GSI's artifact repository as well. Otherwise dependent builds such as the build of the FESA command line tool will fail.

Maven Artifact Repository

Versioned libraries should be deployed into GSI's artifact repository: https://artifacts.acc.gsi.de/nexus/index.html

HowTo in Eclipse

  • checkout the projects from the SVN location above
  • m2e: add a run configuration for Maven Build in which the base directory path is the folder fesa-plugin, goals may be Maven commands such as clean, compile, install, package, ...
  • place the parent pom.xml file in the workspace on top of the projects, the parent pom.xml file holds the definition of

HowTo on the Command Line

  • cd to the workspace or to the folder fesa-plugin-* in the workspace
  • mvn (clean) compile # compiles all projects (modules) defined in parent pom.xml
  • mvn clean compile install # builds and installs everything in local !Maven repository in ~/.m2/...
  • mvn clean compile package # builds and packages all components as jar files
  • mvn clean compile package deploy # builds and packages all components as jar files as well as uploads them into GSI's Nexus Artifact Repository
  • mvn install package -T 1C -Dmaven.test.skip=true -U # builds and installs everything in local !Maven repository in ~/.m2/..., packages everything for installation, skips tests
  • mvn dependency:copy-dependencies -DoutputDirectory=./lib -Dmdep.stripVersion=true # force maven to copy the dependencies into the lib directory

Local Update Site

Tycho creates during mvn install / package phase a local repository in ~/workspace/!fesa-plugin-update-site/target/repository which can be used to install development versions.

Integration in Jenkins

The FESA Eclipse Plugin is hooked into the build system Jenkins.

https://builder.acc.gsi.de/jenkins/job/fesa/job/FESA%20UI/job/fesa-eclipse-plugin-neon/

Everytime the sources in the repository are changed a nightly build is run. The results may be observed on https://builder.acc.gsi.de/jenkins/job/fesa/job/FESA%20UI/ (account required).

The automatic build of the project above trigegrs the automatic build of the FESA command line tool (https://builder.acc.gsi.de/jenkins/job/fesa/job/FESA%20UI/job/fesa-cli-tool/).

Prerequisites

  • Maven integration in Eclipse with plugin m2eclipse, update site: <a href="http://download.eclipse.org/technology/m2e/releases/" rel="nofollow" title="http://download.eclipse.org/technology/m2e/releases/">http://download.eclipse.org/technology/m2e/releases/</a>
  • file pom.xml in every project, embracing pom.xml as parent
  • definition of dependencies in each pom.xml, compare dependencies in META-INF/MANIFEST.MF
  • the required Eclipse jar files have to be present in GSIs Nexus Repository
    • use fesa-plugin-scripts/prepareEclipseJarUpload.py to create the upload shell script, take care of adapting the Eclipse installation directory
    • run the newly created upload.sh shell script to upload the Eclipse jars

Maven Repositories

@GSI: https://artifacts.acc.gsi.de/nexus/index.html#welcome
    <repository>
<id>default</id>
<url>https://artifacts.acc.gsi.de/nexus/index.html#view-repositories;default~browsestorage</url>
</repository>

<repository>
<id>cern-public</id>
<url>https://artifacts.acc.gsi.de/nexus/content/repositories/cern-public/</url>
</repository>

Eclipse Luna: http://download.eclipse.org/releases/neon

    <repository>
<id>luna</id>
<layout>p2</layout>
<!--<url>http://download.eclipse.org/releases/neon</url>-->
<url>http://ftp.halifax.rwth-aachen.de/eclipse/releases/neon/</url>
</repository>

It is recommended to use the german mirror site due to improved connection times.

Useful Maven Commands

Command Description
mvn validate Check wellformendness of a maven pom.xml
mvn dependency:tree Display the dependencies of (a) project/'s
mvn clean Clean up the project/'s
mvn compile Build the project/'s
mvn package Package the project as described in maven pom.xml
mvn install Deployment to local m2 repository in $HOME/.m2/repository/...
mvn deploy Deployment to GSI's artifact repository

mvn clean
mvn compile
mvn clean compile
mvn package
mvn deploy </pre>

Upload Single Libraries to Maven Artifact Repository

To retrieve the required libraries as jar files for each project constituting the FESA Eclipse plug-in certain Eclipse libraries must be uploaded to GSI's artifact repository. The Eclipse dependencies are not available in a repository without p2 layout (https://bugs.eclipse.org/bugs/show_bug.cgi?id=365798). The Eclipse libraries from a downloaded version of Eclipse that is similar to the cluster-wide installation from the plugins folder should be used. During the maven build phase the eclipse libraries are downloaded to the library folder of each plug-in project.
mvn deploy:deploy-file -Dfile=$FILE -DrepositoryId=csco-snapshot -DartifactId=$ARTIFACTID -DgroupId=$GROUPID -Dversion=$VERSION-SNAPSHOT -Durl=https://artifacts.acc.gsi.de/nexus/content/repositories/csco-snapshot
mvn deploy:deploy-file -Dfile=$FILE -DrepositoryId=csco -DartifactId=$ARTIFACTID -DgroupId=$GROUPID -Dversion=$VERSION- -Durl=https://artifacts.acc.gsi.de/nexus/content/repositories/default

https://www-acc.gsi.de/wiki/IN/Maven

https://www-acc.gsi.de/wiki/IN/Maven#Deploy_single_file

http://www.eclipse.org/tycho/

http://www.eclipse.org/m2e/ - update site - http://download.eclipse.org/technology/m2e/releases/1.0

http://codeandme.blogspot.de/2012/12/tycho-build-1-building-plug-ins.html

http://www.vogella.com/articles/EclipseTycho/article.html

http://www.torsten-horn.de/techdocs/maven.htm

Troubleshooting

  • force update of local mvn repository: -U
  • if compilation fails although required jar is copied to lib folder it may be necessary to download it again from the artifact repository. To trigger the new download remove the affected jar from the local m2 repository ($HOME/.m2/repository/...)
  • error message during build of fesa-plugin-update-site: Could not assemble p2 repository: Mirroring failed: No repository found at...
    • solution: mvn package in fesa-plugin-update-site
  • version dependency in sub-project can not be resolved:
    [ERROR] Failed to execute goal on project fesa.plugin.codegen.gsi: Could not resolve dependencies for project de.gsi.cs.co.fe:fesa.plugin.codegen.gsi:jar:2.6.2: Failed to collect dependencies for [cmmnbuild:fesa-japc-codegen:jar:1.0.0 (compile), org.slf4j:slf4j-api:jar:1.7.7 (compile), xalan:xalan:jar:2.7.1 (compile), de.gsi.cs.co.fe:fesa.plugin.utils:jar:2.6.2 (compile), de.gsi.cs.co.fe:fesa.plugin.model:jar:2.6.2 (compile), de.gsi.cs.co.fe:fesa.plugin.model.gsi:jar:2.6.2 (compile), de.gsi.cs.co.fe:fesa.plugin.control:jar:2.6.2 (compile), de.gsi.cs.co.fe:fesa.plugin.control.gsi:jar:2.6.2 (compile)]: Failed to read artifact descriptor for org.eclipse.core:org.eclipse.core.jobs:jar:${org.eclipse.core.jobs.version}: Could not transfer artifact org.eclipse.core:org.eclipse.core.jobs:pom:${org.eclipse.core.jobs.version} from/to default (https://artifacts.acc.gsi.de/nexus/content/repositories/default): Illegal character in path at index 104: https://artifacts.acc.gsi.de/nexus/content/repositories/default/org/eclipse/core/org.eclipse.core.jobs/${org.eclipse.core.jobs.version}/org.eclipse.core.jobs-${org.eclipse.core.jobs.version}.pom -> [Help 1]
    • solution: install parent pom.xml into local repository

  • error during build of all projects with 'mvn clean package -DskipTests -U'
[INFO] fesa.plugin.control 2.9.27 ......................... SUCCESS [  1.166 s]
[INFO] fesa.plugin.control.gsi 2.9.27 ..................... FAILURE [  2.574 s]
[INFO] fesa.plugin.eclipse-2020-06-linux64-jdk8 2.9.22 .... SKIPPED
[INFO] fesa.plugin.bundles 2.9.27 ......................... SKIPPED
[INFO] fesa.plugin.ui 2.9.27 .............................. SKIPPED
[INFO] fesa.plugin.ui.gsi 2.9.27 .......................... SKIPPED
[INFO] fesa.plugin.features 2.9.27 ........................ SKIPPED
[INFO] fesa.plugin.feature 2.9.27 ......................... SKIPPED
[INFO] fesa.plugin.products 2.9.27 ........................ SKIPPED
[INFO] fesa.plugin.repository 2.9.27 ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  26.917 s
[INFO] Finished at: 2021-10-05T14:04:57+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project fesa.plugin.control.gsi: Compilation failure
[ERROR] /common/home/bel/matthies/lnx/git/eclipse-2020-06/plain/fesa.plugin.control.gsi/src/java/cern/fesa/control/utils/LabUtils.java:[635,43] cannot access org.eclipse.core.runtime.Plugin
[ERROR]   bad class file: /home/bel/matthies/lnx/.m2/repository/org/eclipse/platform/org.eclipse.core.runtime/3.23.0/org.eclipse.core.runtime-3.23.0.jar(org/eclipse/core/runtime/Plugin.class)
[ERROR]     class file has wrong version 55.0, should be 52.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.

  • Solution: close the affected Eclipse workspace/session, try
    • mvn clean
    • mvn install -DskipTests
    • mvn package -DskipTests
  • Possible reason: maven cannot handle eclipse built projects (???)

Changelog

Date What
2.11.2012 Initially created (Eclipse Indigo)
2013 Documentation extended / Adapted for Eclipse Kepler
23.09.2014 Adapted for Eclipse Kepler
19.03.2015 Adapted for Eclipse Luna
31.03.2016 Adapted for Eclipse Mars
25.04.2019 Info about Eclipse Jar File Upload for Maven build added
   
-- SolveighMatthies - 02 Nov 2012
Topic revision: r22 - 05 Oct 2021, SolveighMatthies
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback