Skip to content

Instantly share code, notes, and snippets.

@hwellmann
Last active May 14, 2024 13:13
Show Gist options
  • Save hwellmann/6044835 to your computer and use it in GitHub Desktop.
Save hwellmann/6044835 to your computer and use it in GitHub Desktop.
Integrating EMF code generation from an Ecore model into a Tycho build. Sources: my.ecore, my.genmodel, plugin.xml, META-INF/MANIFEST.MF. build.properties Generated Java sources end up in target/generated-sources/emf/src. This directory is included in build.properties as an additional source folder.
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
<!-- tested with 0.18 -->
<version>${tycho.version}</version>
<configuration>
<!-- linebreaks not permitted in this arg line -->
<appArgLine>-data target/workspace -application org.eclipse.emf.codegen.ecore.Generator -projects ${basedir} -model ${basedir}/model/my.genmodel target/generated-sources/emf</appArgLine>
<dependencies>
<dependency>
<artifactId>org.eclipse.emf.codegen.ecore</artifactId>
<type>eclipse-plugin</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>kepler</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/kepler</url>
</repository>
</repositories>
</configuration>
<executions>
<execution>
<goals>
<goal>eclipse-run</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
@twindham
Copy link

I'm trying to use this snippet to add this generator capability to my tycho build.

Currently, my build fails, and I get this error written out to my log file during the build.

I hoping that you can point out what I'm missing.

!SESSION 2016-01-29 14:46:19.469 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -application org.eclipse.emf.codegen.ecore.Generator -projects C:\Users\twindham\git\driverdesign\driverdesign-ui\com.amx.driverdesign.ui.ecore -model C:\Users\twindham\git\driverdesign\driverdesign-ui\com.amx.driverdesign.ui.ecore/model/transport.genmodel target/generated-sources/emf
Command-line arguments: -data target/workspace -application org.eclipse.emf.codegen.ecore.Generator -projects C:\Users\twindham\git\driverdesign\driverdesign-ui\com.amx.driverdesign.ui.ecore -model C:\Users\twindham\git\driverdesign\driverdesign-ui\com.amx.driverdesign.ui.ecore/model/transport.genmodel target/generated-sources/emf

!ENTRY org.eclipse.osgi 4 0 2016-01-29 14:46:25.459
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)

@renelink
Copy link

renelink commented Apr 17, 2018

Use CDATA to prevent formatters from breaking the line

 <appArgLine><![CDATA[-data target/workspace -application org.eclipse.emf.codegen.ecore.Generator -projects ${basedir} -model ${basedir}/model/my.genmodel target/generated-sources/emf]]></appArgLine>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment