Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Building with Maven
Building with Maven [message #1726782] Wed, 16 March 2016 09:25 Go to next message
Eclipse UserFriend
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 11:14 Go to previous messageGo to next message
Eclipse UserFriend
Do you use pure maven or maven tycho
Re: Building with Maven [message #1726801 is a reply to message #1726799] Wed, 16 March 2016 11:15 Go to previous messageGo to next message
Eclipse UserFriend
With Tycho.
Re: Building with Maven [message #1726805 is a reply to message #1726801] Wed, 16 March 2016 11:37 Go to previous messageGo to next message
Eclipse UserFriend
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>
Re: Building with Maven [message #1726883 is a reply to message #1726805] Thu, 17 March 2016 05:16 Go to previous messageGo to next message
Eclipse UserFriend
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 05:19 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Building with Maven [message #1726892 is a reply to message #1726884] Thu, 17 March 2016 06:16 Go to previous messageGo to next message
Eclipse UserFriend
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 06:21 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Building with Maven [message #1726895 is a reply to message #1726893] Thu, 17 March 2016 06:21 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Thu, 17 March 2016 06:22] by Moderator

Re: Building with Maven [message #1726896 is a reply to message #1726883] Thu, 17 March 2016 06:46 Go to previous messageGo to next message
Eclipse UserFriend
@ Vlad
Use Xtext 2.9.2 to fix the security exception
Re: Building with Maven [message #1726897 is a reply to message #1726893] Thu, 17 March 2016 06:51 Go to previous messageGo to next message
Eclipse UserFriend
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 07:26 Go to previous messageGo to next message
Eclipse UserFriend
can you please share a minimal example project
Re: Building with Maven [message #1726910 is a reply to message #1726903] Thu, 17 March 2016 08:04 Go to previous messageGo to next message
Eclipse UserFriend
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 08:05 Go to previous messageGo to next message
Eclipse UserFriend
do you run with -U ?
Re: Building with Maven [message #1726912 is a reply to message #1726911] Thu, 17 March 2016 08:06 Go to previous messageGo to next message
Eclipse UserFriend
No, just "clean verify -fn"
Re: Building with Maven [message #1726913 is a reply to message #1726912] Thu, 17 March 2016 08:14 Go to previous messageGo to next message
Eclipse UserFriend
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 08:22 Go to previous messageGo to next message
Eclipse UserFriend
i cannot reproduce this one (mvn clean install -U)
Re: Building with Maven [message #1727000 is a reply to message #1726913] Fri, 18 March 2016 03:38 Go to previous messageGo to next message
Eclipse UserFriend
http://repo1.maven.org/maven2/org/eclipse/xtext/org.eclipse.xtext.ecore/2.9.2/
Re: Building with Maven [message #1727294 is a reply to message #1726913] Mon, 21 March 2016 15:49 Go to previous messageGo to next message
Eclipse UserFriend
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 15:57 Go to previous messageGo to next message
Eclipse UserFriend
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 13:49 Go to previous messageGo to next message
Eclipse UserFriend
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 15:55 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 12:31:44 EDT 2025

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

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

Back to the top