Xtext DSLs ignored in Maven Multiple Modules Project [message #1798225] |
Wed, 14 November 2018 07:52  |
Eclipse User |
|
|
|
The DSL works within a simple/single maven project. The source folders for the DSLs are found, compiled and everything is working fine.
Within a multiple modules project in which you start the "clean package" from a different project, the xtext-maven-plugin doesn't seem to find any DSLs.
For the simplified example there are three projects:
company.mavenized.example.root (parent project for the dependencies etc)
company.mavenized.example.common (project that also contains the DSLs)
company.mavenized.example.target (project defining the modules etc)
Root Pom:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.company.product</groupId>
<artifactId>example-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>mavenized root</name>
<properties>
<product-base-version>1.0.0-SNAPSHOT</product-base-version>
<product-appgenerator-version>1.2.0-SNAPSHOT</product-appgenerator-version>
<xtext-version>2.13.0</xtext-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
[...]
</repositories>
<pluginRepositories>
[...]
</pluginRepositories>
<build>
<plugins>
<!-- java version festlegen -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<!-- Appgenerator product-Base -->
<dependency>
<groupId>de.company.product</groupId>
<artifactId>de.company.product.base</artifactId>
<version>${product-base-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
<version>${xtext-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Target Pom:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.company.product</groupId>
<artifactId>example-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../company.mavenized.example.root</relativePath>
</parent>
<artifactId>target</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>company.mavenized.example.target</name>
<packaging>pom</packaging>
<modules>
<module>../company.mavenized.example.common</module>
</modules>
</project>
Common Pom:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>company.mavenized.example.common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>company.mavenized.example.common</name>
<parent>
<groupId>de.company.product</groupId>
<artifactId>example-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../company.mavenized.example.root</relativePath>
</parent>
<properties>
<src-gen-folder-name>generated</src-gen-folder-name>
<xtend-src-gen-main>src/main/${src-gen-folder-name}/</xtend-src-gen-main>
<xtend-src-gen-test>src/test/${src-gen-folder-name}/</xtend-src-gen-test>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<!-- maven-clean-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>${xtend-src-gen-main}</directory>
</fileset>
<fileset>
<directory>${xtend-src-gen-test}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
<!-- build-helper-maven-plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${xtend-src-gen-main}</source>
<source>src-gen-once</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- xtext-maven-plugin -->
<!-- appgenerator language config -->
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtext-version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceRoots>
<sourceRoot>src/main/xtext</sourceRoot>
<sourceRoot>src/main/java</sourceRoot>
</sourceRoots>
<languages>
<language>
<setup>de.company.appgenerator.product.companyApplicationDescriptionStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>${xtend-src-gen-main}</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
<dependencies>
<dependency>
<groupId>de.company.appgenerator.product</groupId>
<artifactId>de.company.appgenerator.product</artifactId>
<version>${product-appgenerator-version}</version>
</dependency>
</dependencies>
</plugin>
<!-- xtend-maven-plugin -->
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
<version>${xtext-version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>xtend-install-debug-info</goal>
<goal>testCompile</goal>
<goal>xtend-test-install-debug-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
</dependency>
<dependency>
<groupId>de.company.product</groupId>
<artifactId>de.company.product.base</artifactId>
</dependency>
</dependencies>
<repositories>
[...]
</repositories>
<pluginRepositories>
[...]
</pluginRepositories>
</project>
If I execute "clean package" on the common project, everything works as expected.
But with a "clean package" on the target project, no dsl file is detected.
Regarding the output within the maven build:
Common-clean-package:
[INFO] --- xtext-maven-plugin:2.13.0:generate (default) @ company.mavenized.example.common ---
[INFO] Encoding: UTF-8
[INFO] Compiler source level: 1.8
[INFO] Compiler target level: 1.8
[INFO] Using common types.
[INFO] Collecting source models.
[INFO] Installing type provider.
[INFO] Generating stubs into D:\xyz\product\checkout_xtext\trunk\company.mavenized.example\target\xtext-temp\stubs
[INFO] Compiling stubs located in D:\xyz\product\checkout_xtext\trunk\company.mavenized.example\target\xtext-temp\stubs
[INFO] Nothing to compile. Stubs compilation was skipped.
[INFO] Installing type provider for stubs.
[INFO] Validate and generate.
[INFO]
[INFO] --- xtend-maven-plugin:2.13.0:compile (default) @ company.mavenized.example.common ---
Target-clean-package:
[INFO] --- xtext-maven-plugin:2.13.0:generate (default) @ company.mavenized.example.common ---
[INFO] Encoding: UTF-8
[INFO] Compiler source level: 1.8
[INFO] Compiler target level: 1.8
[INFO] Using common types.
[INFO] Collecting source models.
[INFO] Installing type provider.
[INFO] Generating stubs into D:\xyz\product\checkout_xtext\trunk\company.mavenized.example\target\xtext-temp\stubs
[INFO] Compiling stubs located in D:\xyz\product\checkout_xtext\trunk\company.mavenized.example\target\xtext-temp\stubs
[INFO] Installing type provider for stubs.
[INFO] Validate and generate.
[INFO] Starting validation for input: 'example.productdsl'
[...-only output from the DSL while generating-...]
[INFO] Starting generator for input: 'example.productdsl'
[INFO]
[INFO] --- xtend-maven-plugin:2.13.0:compile (default) @ company.mavenized.example.common ---
Big question is: How can I fix it? Did I miss something or is there a setting/config I need to provide for multiple module projects?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07899 seconds