eclipse-emf / org.eclipse.emf

Eclipse Public License 2.0
10 stars 13 forks source link

Failing to compile EMF with tycho in Gitpod #34

Closed zohrakaouter closed 4 weeks ago

zohrakaouter commented 1 month ago

I imported the github repo of EMF to create Gitpod repository, here is the link to the workspace : https://gitpod.io#snapshot/0620c935-c2eb-4bdf-a1e7-0d5e87d89db3 When I run "mvn compile" it gives this errors :

Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project org.eclipse.emf.parent: Cannot find matching toolchain definitions for the following toolchain types: [ERROR] jdk [ id='JavaSE-11' ] [ERROR] Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.

Here is the pom file :

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <modelVersion>4.0.0</modelVersion>

  <groupId>org.eclipse.emf</groupId>
  <artifactId>org.eclipse.emf.parent</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <tycho.scmUrl>scm:git:https://github.com/eclipse-emf/org.eclipse.emf.git</tycho.scmUrl>
    <tycho-version>4.0.8</tycho-version>
    <jarsigner-version>1.4.3</jarsigner-version>
    <javaVersion>11</javaVersion>
    <os-jvm-flags/>
  </properties>

  <modules>
    <module>plugins</module>
    <module>features</module>
    <module>tp</module>
  </modules>

  <profiles>
    <profile>
      <id>about-mappings</id>
      <activation>
        <file>
          <exists>about.mappings</exists>
        </file>
      </activation>
      <build>
        <resources>
          <resource>
            <directory>.</directory>
            <filtering>true</filtering>
            <includes>
              <include>about.mappings</include>
            </includes>
          </resource>
        </resources>
      </build>
    </profile>

    <!-- Build the site only if we are building Xcore. -->
    <profile>
      <id>site</id>
      <activation>
        <file>
         <missing>tp/${target-platform}-no-xcore</missing>
        </file>
      </activation>
      <modules>
        <module>../org.eclipse.emf.site</module>
      </modules>
    </profile>

    <profile>
      <id>promote</id>
      <activation>
        <property>
          <name>promote</name>
          <value>!false</value>
        </property>
      </activation>
      <modules>
        <module>promotion</module>
      </modules>
    </profile>
  </profiles>

  <pluginRepositories>
    <pluginRepository>
      <id>eclipse-maven-releases</id>
      <url>https://repo.eclipse.org/content/repositories/releases</url>
    </pluginRepository>
    <pluginRepository>
      <id>eclipse-cbi-releases</id>
      <url>https://repo.eclipse.org/content/repositories/cbi-releases</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-maven-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>

      <!-- This is needed to ensure that surefire uses an older JDK with older target platforms. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-toolchains-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <goals>
              <goal>toolchain</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <toolchains>
            <jdk>
              <id>JavaSE-${javaVersion}</id>
            </jdk>
          </toolchains>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-maven-plugin</artifactId>
          <version>${tycho-version}</version>
          <extensions>true</extensions>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-packaging-plugin</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <format>'v'yyyyMMdd-HHmm</format>
            <sourceReferences>
              <generate>true</generate>
            </sourceReferences>
            <timestampProvider>jgit</timestampProvider>
            <jgit.ignore>pom.xml .gitignore</jgit.ignore>
            <jgit.dirtyWorkingTree>warning</jgit.dirtyWorkingTree>
            <additionalFileSets>
              <fileSet>
                <directory>${project.build.outputDirectory}</directory>
                <includes>
                  <include>about.mappings</include>
                </includes>
              </fileSet>
            </additionalFileSets>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.eclipse.tycho.extras</groupId>
              <artifactId>tycho-sourceref-jgit</artifactId>
              <version>${tycho-version}</version>
            </dependency>
            <dependency>
              <groupId>org.eclipse.tycho</groupId>
              <artifactId>tycho-buildtimestamp-jgit</artifactId>
              <version>${tycho-version}</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>target-platform-configuration</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <target>
              <artifact>
                <groupId>org.eclipse.emf</groupId>
                <artifactId>org.eclipse.emf.tp</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <classifier>${target-platform}</classifier>
              </artifact>
            </target>
            <!--executionEnvironmentDefault>JavaSE-${javaVersion}</executionEnvironmentDefault -->
            <environments>
              <environment>
                <os>win32</os>
                <ws>win32</ws>
                <arch>x86_64</arch>
              </environment>
              <environment>
                <os>macosx</os>
                <ws>cocoa</ws>
                <arch>x86_64</arch>
              </environment>
              <environment>
                <os>linux</os>
                <ws>gtk</ws>
                <arch>x86_64</arch>
              </environment>
            </environments>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-source-plugin</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.cbi.maven.plugins</groupId>
          <artifactId>eclipse-jarsigner-plugin</artifactId>
          <version>${jarsigner-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-plugin</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho.extras</groupId>
          <artifactId>tycho-source-feature-plugin</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-surefire-plugin</artifactId>
          <version>${tycho-version}</version>
          <executions>
            <execution>
              <id>default-test</id>
              <phase>integration-test</phase>
              <goals>
                <goal>test</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <appArgLine></appArgLine>
            <useJDK>SYSTEM</useJDK>
            <argLine>
              -Xmx1024m
              -ea
              -Dorg.eclipse.emf.common.util.ReferenceClearingQueue=true
            </argLine>
            <useUIHarness>false</useUIHarness>
            <useUIThread>true</useUIThread>
          </configuration>
        </plugin>

      </plugins>
    </pluginManagement>
  </build>

</project>

I tried to edit my toolchains.xml file to add the jdk definition, but always the same error, here is the toolchains.xml :

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">

<toolchain>
    <type>jdk</type>
    <provides>
      <version>11</version>
      <vendor>openjdk</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-11-openjdk-11.0.23.0.9-1.fc38.x86_64</jdkHome>
    </configuration>
  </toolchain>
</toolchains>

To reproduce the issue : 1) Go to https://gitpod.io/ 2) Continue with Github 3) New workspace with putting the link to emf : https://github.com/eclipse-emf/org.eclipse.emf 4) Run mvn compile

Thank you in advance

merks commented 4 weeks ago

Sorry, I can't ensure that anything works on gitpod.

Here is how you can provision and EMF development environment identical to what I use:

https://github.com/eclipse-simrel/simrel.build/issues/438

Then you can run a Maven build locally via the provided launcher:

image

My local toolschains.xml is like this:

<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-1.8</id>
      <version>1.8</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>C:/Program Files/Java/jdk1.8.0_261</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-11</id>
      <version>11</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>C:/Program Files/Java/jdk-11.0.13+8</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-17</id>
      <version>17</version>
      <vendor>adoptium</vendor>
    </provides>
    <configuration>
        <jdkHome>C:/Program Files/Java/jdk-17.0.5+8</jdkHome>
    </configuration>
  </toolchain>
</toolchains>

I think your version of the file should use those IDs you see above.

The builds run here:

https://ci.eclipse.org/emf/job/build/

Note that the builds are currently using -DjavaVersion=17.