Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] Strange erroneous behavior of xtext-maven-plugin
[SOLVED] Strange erroneous behavior of xtext-maven-plugin [message #1736897] Mon, 04 July 2016 09:27 Go to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Dear all.

I have defined a Eclipse plugin with Java and my DSL code inside:

<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>io.sarl</groupId>
		<artifactId>io.sarl.plugins</artifactId>
		<version>0.4.0-SNAPSHOT</version>
	</parent>
	<artifactId>io.sarl.core</artifactId>
	<packaging>eclipse-plugin</packaging>
	<name>SDK Core Library</name>

	<build>
		<resources>
			<resource>
				<directory>src/main/sarl</directory>
				<includes>
					<include>**/*.sarl</include>
				</includes>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/main/sarl</source>
								<source>src/main/generated-sources/sarl/</source>
								<source>src/test/generated-sources/sarl/</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<executions>
					<execution>
						<phase>clean</phase>
						<goals>
							<goal>clean</goal>
						</goals>
						<configuration>
							<filesets>
								<fileset>
									<directory>src/main/generated-sources/sarl</directory>
								</fileset>
								<fileset>
									<directory>src/test/generated-sources/sarl</directory>
								</fileset>
							</filesets>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.eclipse.xtext</groupId>
				<artifactId>xtext-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<encoding>${project.build.sourceEncoding}</encoding>
					<compilerSourceLevel>${compiler.level}</compilerSourceLevel>
					<compilerTargetLevel>${compiler.level}</compilerTargetLevel>
					<failOnValidationError>true</failOnValidationError>
					<languages>
						<language>
							<setup>io.sarl.lang.SARLStandaloneSetup</setup>
							<outputConfigurations>
								<outputConfiguration>
									<outputDirectory>src/main/generated-sources/sarl/</outputDirectory>
								</outputConfiguration>
							</outputConfigurations>
						</language>
					</languages>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>io.sarl.lang</groupId>
						<artifactId>io.sarl.lang</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>io.sarl.lang</groupId>
						<artifactId>io.sarl.lang.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse</groupId>
						<artifactId>osgi</artifactId>
						<version>${osgi.nls.version}</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.xtend</groupId>
						<artifactId>org.eclipse.xtend.core</artifactId>
						<version>${xtext.version}</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>

</project>


Note that the scripts written with my DSL are using Java classes that are defined in the same maven module.


With Xtext 2.10.0 and Eclipse Mars.2 API everything is working perfectly when compiling from the command line with Maven.

After upgrading my project to Eclipse Neon API, I 'm obtaining a strange compilation error on the command line.
* "mvn clean install" works perfectly in the directory of the project module.
* "mvn clean install" fails when it is launched from one of the parent modules (complete log attached). It indicates that the Java class "AgentTask". But is is defined in the "src/main/java" folder, and the "class file" is present inside the "target/classes" folder of module.

Do anyone encountered this problem? Or have a fix for the xtext-maven-plugin configuration?

All the best.
Stéphane.
  • Attachment: compile.log
    (Size: 38.63KB, Downloaded 87 times)

[Updated on: Mon, 04 July 2016 19:53]

Report message to a moderator

Re: Strange erroneous behavior of xtext-maven-plugin [message #1736902 is a reply to message #1736897] Mon, 04 July 2016 09:58 Go to previous messageGo to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
I have discovered a new point. The module "io.sarl.lang:io.sarl.lang" is in the dependencies of the xtext-maven-plugin.
If this project is inside the current build tree (as a submodule of the parent module of the failing module), the failure occurs. If this module is obtained from the ".m2" the failure does not occur.

The module "io.sarl.lang:io.sarl.lang" contains the DSL compiler.

[Updated on: Mon, 04 July 2016 09:59]

Report message to a moderator

Re: Strange erroneous behavior of xtext-maven-plugin [message #1736904 is a reply to message #1736902] Mon, 04 July 2016 10:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Stephane Galland <forums-noreply@xxxxxxxx> wrote:
> I have discovered a new point. The module "io.sarl.lang:io.sarl.lang" is
> in the dependencies of the xtext-maven-plugin.
> If this project is inside the current build tree (as a submodule of the
> parent module of the failing module), the failure occurs. If this module
> is obtained from the ".m2" the failure does not occur.

What Happens if you add a project dependency to the Lang module to the Pom
as well


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange erroneous behavior of xtext-maven-plugin [message #1736915 is a reply to message #1736904] Mon, 04 July 2016 11:31 Go to previous messageGo to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Adding io.sarl.lang module in the build.properties of the io.sarl.core module does not solve the problem:
source.. = src/main/java,\
           src/main/sarl,\
           src/main/generated-sources/sarl
bin.includes = META-INF/,\
               .,\
               OSGI-INF/
jre.compilation.profile = JavaSE-1.8
additional.bundles = io.sarl.lang


When I take a look in the "target/classes" folder of the "io.sarl.core" module, there is no generated classes from the Java code "AgentTask.class" inside the module. They are needed by the xtext-based compiler, I guess.
Again, theses class files are generated if I remove "io.sarl.lang" from the current build tree.

Is a way to what xtext-maven-plugin is doing regarding the Java compiler?

[Updated on: Mon, 04 July 2016 11:32]

Report message to a moderator

Re: Strange erroneous behavior of xtext-maven-plugin [message #1736920 is a reply to message #1736915] Mon, 04 July 2016 11:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you create a small example reproducing the problem?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange erroneous behavior of xtext-maven-plugin [message #1736931 is a reply to message #1736897] Mon, 04 July 2016 12:16 Go to previous messageGo to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Please find a simplified project attached to this message.

Command lines that work:
cd debug/io.sarl.core
mvn clean install


Command lines that do not work:
cd debug
mvn clean install
  • Attachment: test_bug.zip
    (Size: 666.57KB, Downloaded 112 times)
Re: Strange erroneous behavior of xtext-maven-plugin [message #1736937 is a reply to message #1736931] Mon, 04 July 2016 12:54 Go to previous messageGo to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
When running Maven with debug output from the root directory of the "testing project", I obtain the following error from xtext-maven-plugin, but without details:
[INFO] invoke batch compiler with '-verbose -cp "/home/sgalland/.m2/repository/p2/osgi/bundle/com.google.guava/15.0.0.v201403281430/com.google.guava-15.0.0.v201403281430.jar:/home/sgalland/tmp/debug/io.sarl.lang.core/target/io.sarl.lang.core-0.4.0-SNAPSHOT.jar:/home/sgalland/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.xbase.lib/2.10.0.v201605250459/org.eclipse.xtext.xbase.lib-2.10.0.v201605250459.jar:/home/sgalland/.m2/repository/p2/osgi/bundle/javax.inject/1.0.0.v20091030/javax.inject-1.0.0.v20091030.jar" -d "/home/sgalland/tmp/debug/io.sarl.core/target/xtext-temp/classes" -source 1.8 -target 1.8 -proceedOnError "/home/sgalland/tmp/debug/io.sarl.core/src/main/java" "/home/sgalland/tmp/debug/io.sarl.core/src/main/sarl" "/home/sgalland/tmp/debug/io.sarl.core/target/xtext-temp/stubs"'
[WARNING] Unable to load annotation processing manager org.eclipse.jdt.internal.compiler.apt.dispatch.BatchAnnotationProcessorManager from classpath.
[INFO] Stubs compilation finished with errors.


When compiling from the "io.sarl.core" folder, the stub generation is a success.
Re: Strange erroneous behavior of xtext-maven-plugin [message #1736939 is a reply to message #1736937] Mon, 04 July 2016 13:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
i am not sure if it is ok to compile a xtend-subdsl with xtext maven plugin

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange erroneous behavior of xtext-maven-plugin [message #1736948 is a reply to message #1736939] Mon, 04 July 2016 14:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
here is what works for me

<dependency>
						<groupId>io.sarl.lang</groupId>
						<artifactId>io.sarl.lang</artifactId>
						<version>${project.version}</version>
						<exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
					</dependency>
					<dependency>
						<groupId>io.sarl.lang</groupId>
						<artifactId>io.sarl.lang.core</artifactId>
						<version>${project.version}</version>
						<exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
					</dependency>


( i addded the excludes)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange erroneous behavior of xtext-maven-plugin [message #1736988 is a reply to message #1736948] Mon, 04 July 2016 19:53 Go to previous message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
Your solution is the good one. Indeed, I have determined that tycho is not providing the same dependencies in the two cases. Your solution permits to skip this problem.
Previous Topic:xtext with multiple file extensions
Next Topic:Problem with referencedResource and gradle
Goto Forum:
  


Current Time: Thu Mar 28 20:24:16 GMT 2024

Powered by FUDForum. Page generated in 0.04259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top