Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Building with Maven
Building with Maven [message #1726782] Wed, 16 March 2016 13:25 Go to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Hi,

I am building now most of my projects with Maven and it looks good, but there is one where I'm not sure how to handle. It has a custom scoping fragment (in a separate plugin) that is needed when compiling the grammar.

How should I configure Maven so that the scoping fragment code is on the classpath for the Xtext compiler? I hope I'm just missing some stupidly obvious detail, but I don't know much about Maven...

best regards,
Vlad
Re: Building with Maven [message #1726799 is a reply to message #1726782] Wed, 16 March 2016 15:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Do you use pure maven or maven tycho

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1726801 is a reply to message #1726799] Wed, 16 March 2016 15:15 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
With Tycho.
Re: Building with Maven [message #1726805 is a reply to message #1726801] Wed, 16 March 2016 15:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
option 1:

simply add it to the required bundles of your .mydsl projects manifest.mf

option 2:

adopt the call of the maven exec plugin (will leave the workflow in eclipse with errors)

<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.4.0</version>
				<executions>
					<execution>
						<id>mwe2Launcher</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
					<arguments>
						<argument>/${project.basedir}/src/org/xtext/example/mydsl5/GenerateMyDsl.mwe2</argument>
						<argument>-p</argument>
						<argument>rootPath=/${project.basedir}/..</argument>
					</arguments>
					<classpathScope>compile</classpathScope>
					<includePluginDependencies>true</includePluginDependencies>
					<cleanupDaemonThreads>false</cleanupDaemonThreads><!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.eclipse.emf</groupId>
						<artifactId>org.eclipse.emf.mwe2.launch</artifactId>
						<version>2.8.3</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.xtext</groupId>
						<artifactId>org.eclipse.xtext.xtext.generator</artifactId>
						<version>${xtextVersion}</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.xtext</groupId>
						<artifactId>org.eclipse.xtext.xbase</artifactId>
						<version>${xtextVersion}</version>
					</dependency>
					<dependency>
						<groupId>org.xtext.example.mydsl5</groupId>
						<artifactId>org.xtext.example.mydsl5.util</artifactId>
						<version>1.0.0-SNAPSHOT</version>
					</dependency>
				</dependencies>
			</plugin>


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1726883 is a reply to message #1726805] Thu, 17 March 2016 09:16 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Thank you Christian!

I had the scoping bundled as required by the main one, but it didn't help. Adding the dependency in the pom.xml helped, but now I get an interesting exception:

...
144  [org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main()] WARN  lipse.emf.mwe.utils.StandaloneSetup  - Skipping conflicting project org.eclipse.xtext at 'archive:file:/C:/Users/vladdu/.m2/repository/org/eclipse/xtext/org.eclipse.xtext/2.8.4/org.eclipse.xtext-2.8.4.jar!/' and using 'archive:file:/C:/Users/vladdu/.m2/repository/p2/osgi/bundle/org.eclipse.xtext/2.9.1.v201512180746/org.eclipse.xtext-2.9.1.v201512180746.jar!/' instead.
...
java.lang.SecurityException: class "org.eclipse.xtext.util.XtextSwitch"'s signer information does not match signer information of other classes in the same package


Any idea what this can be about?

regards,
Vlad
Re: Building with Maven [message #1726884 is a reply to message #1726883] Thu, 17 March 2016 09:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
the preferred way is the required bundle.

how do you build the fragment containing bundle?

that error means that there is something strange with the jars on your classpath regarding signing.
there where some bugs on this that are fixed with 2.9.2


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1726892 is a reply to message #1726884] Thu, 17 March 2016 10:16 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
It is part of the same project, so it is built by maven right at the beginning.

Unfortunately I am stuck with 2.8.4 at the moment, I'm not even sure why it wants to use any other version... I tries specifying tighter versions, but to no effect.

/Vlad
Re: Building with Maven [message #1726893 is a reply to message #1726892] Thu, 17 March 2016 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
then simply go the required plugin stuff.

- make sure the fragment plugin exports the fragments package
- add a dependeny to the manifest of the mydsl project.

this should work perfectly


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1726895 is a reply to message #1726893] Thu, 17 March 2016 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
p.s. you use xtext 2.9.x and xtext 2.8.4 at the same time ?!?
the code i pasted is for 2.9.x only


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 17 March 2016 10:22]

Report message to a moderator

Re: Building with Maven [message #1726896 is a reply to message #1726883] Thu, 17 March 2016 10:46 Go to previous messageGo to next message
Dennis Huebner is currently offline Dennis HuebnerFriend
Messages: 257
Registered: July 2009
Senior Member

@ Vlad
Use Xtext 2.9.2 to fix the security exception



+Dennis Huebner

Get professional support from the Xtext committers at www.typefox.io
Re: Building with Maven [message #1726897 is a reply to message #1726893] Thu, 17 March 2016 10:51 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Thanks for the patience.

The bundle with the mwe2 fragment exports the package and the main bundle depends on it, but it doesn't work without specifying it in the pom too.

It's a bit complicated about the versions. I am using 2.8.4, but one of my dev envs has 2.10. The other (production) has no internet access so I have a difficult time testing there. I supposed that the Maven build doesn't care what Xtext is installed in my Eclipse, as long as the dependencies and the target point to 2.8.4.

Re: Building with Maven [message #1726903 is a reply to message #1726897] Thu, 17 March 2016 11:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you please share a minimal example project

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1726910 is a reply to message #1726903] Thu, 17 March 2016 12:04 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
I tried to update to 2.9.2 in a fresh environment and I get

Execution default of goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java failed: Plugin org.codehaus.mojo:exec-maven-plugin:1.4.0 or one of its dependencies could not be resolved: Failed to collect dependencies at org.codehaus.mojo:exec-maven-plugin:jar:1.4.0 -> org.eclipse.xtext:org.eclipse.xtext.xtext:jar:2.9.2 -> org.eclipse.xtext:org.eclipse.xtext.generator:jar:2.9.2 -> org.eclipse.xtext:org.eclipse.xtext.ecore:jar:[2.9.2]: No versions available for org.eclipse.xtext:org.eclipse.xtext.ecore:jar:[2.9.2] within specified range -> [Help 1]

I will try to reproduce with a small example.
Re: Building with Maven [message #1726911 is a reply to message #1726910] Thu, 17 March 2016 12:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
do you run with -U ?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1726912 is a reply to message #1726911] Thu, 17 March 2016 12:06 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
No, just "clean verify -fn"
Re: Building with Maven [message #1726913 is a reply to message #1726912] Thu, 17 March 2016 12:14 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
using a fresh mydsl project, generated with the wizard, using 2.9.2 on Mars, I get a similar error:

Execution default of goal org.eclipse.xtend:xtend-maven-plugin:2.9.2:compile failed: Plugin org.eclipse.xtend:xtend-maven-plugin:2.9.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.eclipse.xtend:xtend-maven-plugin:jar:2.9.2 -> org.eclipse.xtend:org.eclipse.xtend.core:jar:[2.9.2]: No versions available for org.eclipse.xtend:org.eclipse.xtend.core:jar:[2.9.2] within specified range -> [Help 1]
Re: Building with Maven [message #1726914 is a reply to message #1726913] Thu, 17 March 2016 12:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
i cannot reproduce this one (mvn clean install -U)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Building with Maven [message #1727000 is a reply to message #1726913] Fri, 18 March 2016 07:38 Go to previous messageGo to next message
Dennis Huebner is currently offline Dennis HuebnerFriend
Messages: 257
Registered: July 2009
Senior Member

http://repo1.maven.org/maven2/org/eclipse/xtext/org.eclipse.xtext.ecore/2.9.2/


+Dennis Huebner

Get professional support from the Xtext committers at www.typefox.io
Re: Building with Maven [message #1727294 is a reply to message #1726913] Mon, 21 March 2016 19:49 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 17/03/2016 13:14, Vlad Dumitrescu wrote:
> using a fresh mydsl project, generated with the wizard, using 2.9.2 on
> Mars, I get a similar error:
>
> Execution default of goal
> org.eclipse.xtend:xtend-maven-plugin:2.9.2:compile failed: Plugin
> org.eclipse.xtend:xtend-maven-plugin:2.9.2 or one of its dependencies
> could not be resolved: Failed to collect dependencies at
> org.eclipse.xtend:xtend-maven-plugin:jar:2.9.2 ->
> org.eclipse.xtend:org.eclipse.xtend.core:jar:[2.9.2]: No versions
> available for org.eclipse.xtend:org.eclipse.xtend.core:jar:[2.9.2]
> within specified range -> [Help 1]
>

Hi

that happens to me almost all the times I switch to a new Xtext version
for the artifacts: you need to use -U ("Update Snapshots").

cheers
Lorenzo

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


Re: Building with Maven [message #1727295 is a reply to message #1727294] Mon, 21 March 2016 19:57 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
I see. Thank you!

Why is it that so much stuff starts as "a simpler way to do X" and slowly gets to where it requires solving the "Da Vinci code" every time? Smile I mean, assembling plugins is probably #2 activity for any Eclipse developer, right after compiling the code... it should be easy!

/Vlad
Re: Building with Maven [message #1727404 is a reply to message #1727295] Tue, 22 March 2016 17:49 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 21/03/2016 20:57, Vlad Dumitrescu wrote:
> I see. Thank you!
>
> Why is it that so much stuff starts as "a simpler way to do X" and
> slowly gets to where it requires solving the "Da Vinci code" every time?
> :) I mean, assembling plugins is probably #2 activity for any Eclipse
> developer, right after compiling the code... it should be easy!
>
> /Vlad
>

The "joys" of Maven :->


Re: Building with Maven [message #1727559 is a reply to message #1727404] Wed, 23 March 2016 19:55 Go to previous message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
That too, but I was referring to how to package Eclipse plugins. It's painful...
/Vlad
Previous Topic:Could not find any exported element of type 'FamilyDeclaration' -> Slot 'familyDeclaration' is em
Next Topic:UML2 - text editor
Goto Forum:
  


Current Time: Fri Mar 29 07:31:08 GMT 2024

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

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

Back to the top