Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext-maven-plugin overwriting output configuration(maven does not write to src-gen but only the default directory)
xtext-maven-plugin overwriting output configuration [message #1469487] Tue, 11 November 2014 16:51 Go to next message
Steffen Härtlein is currently offline Steffen HärtleinFriend
Messages: 8
Registered: November 2014
Junior Member
Hi,
I'm not sure what I do wrong and maybe the solution is quite easy.
As also described in this thread, I am trying to use the xtext-maven-plugin but it does not write to another folder.

What I try to do is generate Java code standalone from maven and it works using the xtext-maven-plugin.

...
<outputConfigurations>
    <outputConfiguration>
        <outputDirectory>${project.basedir}/src-gen</outputDirectory>
    </outputConfiguration>
<outputConfigurations>
...


All that happens is the code is updating in "target/xtext-temp/<and so on>", the default location.

Does anybody know how to fix that? I use version 2.6.2 of the xtext-maven-plugin.

Regards,
Steffen
Re: xtext-maven-plugin overwriting output configuration [message #1469712 is a reply to message #1469487] Tue, 11 November 2014 21:00 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/11/2014 17:51, Steffen Härtlein wrote:
> Hi,
> I'm not sure what I do wrong and maybe the solution is quite easy.
> As also described in https://www.eclipse.org/forums/index.php/t/804028/
> thread, I am trying to use the xtext-maven-plugin but it does not write
> to another folder.
>
> What I try to do is generate Java code standalone from maven and it
> works using the xtext-maven-plugin.
>
>
> ..
> <outputConfigurations>
> <outputConfiguration>
> <outputDirectory>${project.basedir}/src-gen</outputDirectory>
> </outputConfiguration>
> <outputConfigurations>
> ..
>
>
> All that happens is the code is updating in "target/xtext-temp/<and so
> on>", the default location.

Hi

from what I know the target/xtext-temp contains the temporary stub Java
classes, the actual generated code should go into the directory you
specified... does src-gen contain anything?

cheers
Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: xtext-maven-plugin overwriting output configuration [message #1470326 is a reply to message #1469712] Wed, 12 November 2014 08:53 Go to previous messageGo to next message
Steffen Härtlein is currently offline Steffen HärtleinFriend
Messages: 8
Registered: November 2014
Junior Member
No, src-gen is empty and not even affected by the maven install, regarding to the timestamp.
I also tried the solutions in the thread I linked in my first post, but it didn't help anything.

greetings, Steffen
Re: xtext-maven-plugin overwriting output configuration [message #1470381 is a reply to message #1470326] Wed, 12 November 2014 09:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

in my example (https://github.com/cdietrich/xtext-maven-example) this works fine


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext-maven-plugin overwriting output configuration [message #1470415 is a reply to message #1470381] Wed, 12 November 2014 10:12 Go to previous messageGo to next message
Steffen Härtlein is currently offline Steffen HärtleinFriend
Messages: 8
Registered: November 2014
Junior Member
I had a look at it several times now and it's a great example! That's why I do not understand why it is still not working.

I will post my pom.xml here now and hope that it was just a dumb little mistake I made:

<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>Student</artifactId>
  <groupId>com.mycompany.tme.project.student</groupId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>Student</name>
  <build>
    <sourceDirectory>src-gen</sourceDirectory>
    <plugins>
      <plugin>
      	<groupId>org.codehaus.mojo</groupId>
      	<artifactId>build-helper-maven-plugin</artifactId>
      	<version>1.7</version>
      	<executions>
      		<execution>
	            <id>add-source</id>
	            <phase>initialize</phase>
	            <goals>
	              <goal>add-source</goal>
	            </goals>
	            <configuration>
	            	<sources>
	            		<source>src-gen</source>
	            	</sources>
	            </configuration>
          	</execution>
      	</executions>
      </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>src-gen</directory>
					<includes>
						<include>**/*</include>
					        </includes>
				  </fileset>
			   </filesets>
		    </configuration>
	       </execution>
	     </executions>
	 </plugin>
	<plugin>
		<groupId>org.eclipse.xtext</groupId>
		<artifactId>xtext-maven-plugin</artifactId>
		 <version>2.6.2</version>
		 <executions>
			<execution>
				<goals>
					<goal>generate</goal>
				 </goals>
			</execution>
		    </executions>
		<configuration>
			<languages>
				<language>
					 <setup>org.eclipse.xtext.ecore.EcoreSupport</setup>
				</language>
				 <language>
					 <setup>org.eclipse.emf.codegen.ecore.xtext.GenModelSupport</setup>
				</language>
				  <language>
					 <setup>org.eclipse.emf.ecore.xcore.XcoreStandaloneSetup</setup>
					<outputConfigurations>
						 <outputConfiguration>
							 <outputDirectory>src-gen/</outputDirectory>
							<createOutputDirectory>true</createOutputDirectory>
							 <overrideExistingResources>true</overrideExistingResources>
							 <cleanUpDerivedResources>true</cleanUpDerivedResources>
						</outputConfiguration>
					 </outputConfigurations>
				 </language>
			 </languages>
			<sourceRoots>
				<root>model/</root>
			</sourceRoots>
		 </configuration>
		<dependencies>
			<dependency>
 				<groupId>org.osgi</groupId>
				<artifactId>org.osgi.core</artifactId>
				<version>4.3.1</version>
			 </dependency>
			<dependency>
				 <groupId>org.eclipse.core</groupId>
				 <artifactId>org.eclipse.core.resources</artifactId>
				<version>3.7.100</version>
			</dependency>
			 <dependency>
				<groupId>org.eclipse.text</groupId>
				<artifactId>org.eclipse.text</artifactId>
				 <version>3.5.101</version>
			</dependency>
			<dependency>
                                 <groupId>org.eclipse.emf</groupId>
				<artifactId>org.eclipse.emf.codegen.ecore.xtext</artifactId>
				 <version>1.1.1</version>
			    </dependency>
			<dependency>
				<groupId>org.eclipse.emf</groupId>
				 <artifactId>org.eclipse.emf.ecore.xcore.lib</artifactId>
				 <version>1.1.0</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.emf</groupId>
				 <artifactId>org.eclipse.emf.ecore.xcore</artifactId>
				<version>1.2.0</version>
			</dependency>
		 </dependencies>
	</plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <webappDirectory>webapp</webappDirectory>
        </configuration>
      </plugin>
      <plugin>
      	<groupId>org.apache.maven.plugins</groupId>
      	<artifactId>maven-war-plugin</artifactId>
      	<version>2.4</version>
      	<configuration>
      		<failOnMissingWebXml>false</failOnMissingWebXml>
      	</configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  	<dependency>
  		<groupId>org.eclipse.emf.ecore</groupId>
  		<artifactId>org.eclipse.emf.ecore</artifactId>
  		<version>2.10.1.v20140901-1043</version>
  	</dependency>
  	<dependency>
  		<groupId>org.eclipse.emf.common</groupId>
  		<artifactId>org.eclipse.emf.common</artifactId>
  		<version>2.10.1.v20140901-1043</version>
  	</dependency>
  </dependencies>
</project>


The (relevant) maven output I get on mvn install:
...
[INFO] --- xtext-maven-plugin:2.6.2:generate (default) @ Student ---
[INFO] Encoding: not set. Encoding provider will be used.
[INFO] Compiler source level: 1.5
[INFO] Compiler target level: 1.5
[INFO] Using common types.
[INFO] Collecting source models.
[INFO] Installing type provider.
[INFO] Generating stubs into /path/to/my/project/Student/target/xtext-temp/stubs
[INFO] Compiling stubs located in /path/to/my/project/Student/target/xtext-temp/stubs
[INFO] Installing type provider for stubs.
[INFO] Starting generator for input: 'Student.xcore'
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ Student ---
...

And scr-gen is empty in the end
Re: xtext-maven-plugin overwriting output configuration [message #1470427 is a reply to message #1470415] Wed, 12 November 2014 10:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

maybe it is somehow releated to xcore.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext-maven-plugin overwriting output configuration [message #1470464 is a reply to message #1470427] Wed, 12 November 2014 11:03 Go to previous message
Steffen Härtlein is currently offline Steffen HärtleinFriend
Messages: 8
Registered: November 2014
Junior Member
It seems like, yes.
According to https://bugs.eclipse.org/bugs/show_bug.cgi?id=410736, you already worked on that, if you are the same Christian Dietrich. In this post there also is an attachment in one of the answers that shows a solution that seems to work. But when I use the configuration in my project, it doesn't...
Previous Topic:Linking in Xtend - different proxy URIs
Next Topic:Problems with LazyLinkingResource URI in GMF integration
Goto Forum:
  


Current Time: Thu Apr 18 02:33:43 GMT 2024

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

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

Back to the top