Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [ACCELEO] Compiling multi-plugin project using maven
[ACCELEO] Compiling multi-plugin project using maven [message #780801] Thu, 19 January 2012 07:40 Go to next message
Filip Krikava is currently offline Filip Krikava
Messages: 43
Registered: January 2012
Member
Hi,

I'm using maven+type to build my project that consists of multiple eclipse plugins. My structure is like:

net.fikovnik.projects.taco.core/
../files/graphwiz.mtl
../common/uml.mtl
net.fikovnik.projects.taco.latex.core/
../files/modelRefernce.mtl (that uses both graphwiz and uml module defined in the plugin above)

In Eclipse itself this works well, but during the maven built I got following error:

Caused by: java.lang.RuntimeException: modelReference.mtl
31:Module net::fikovnik::projects::taco::core::gen::common::uml not found.
32:Module net::fikovnik::projects::taco::core::gen::files::graphwiz not found.
62:Cannot find operation (genPrologue()) for the type (EClass)
63:Cannot find operation (genClass(Boolean, Boolean, Boolean, String)) for the type (EClass)
64:Cannot find operation (genEpilogue()) for the type (EClass)
76:Cannot find operation (genPrologue()) for the type (EPackage)
77:Cannot find operation (genPackage(Boolean)) for the type (EPackage)
78:Cannot find operation (genEpilogue()) for the type (EPackage)
105:Cannot find operation (genFeatureLabelWithType()) for the type (EStructuralFeature)

	at org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler.compile(AbstractAcceleoCompiler.java:281)
	at org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler.doCompile(AbstractAcceleoCompiler.java:225)
	at net.fikovnik.projects.taco.latex.AcceleoCompiler.doCompile(AcceleoCompiler.java:54)
	at net.fikovnik.projects.taco.latex.AcceleoCompiler.main(AcceleoCompiler.java:44)
	... 6 more


I'm not sure how can I make the generated AcceleoCompiler to see these files as well. The execution classpath contains correctly all the plugins and their dependencies.

I tried to experiment a bit with the generated pom.xml file to add arguments for the dependencies, but I'm not really sure what should be there. Putting there the full path to the depending mtl file does not work.

<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.1.1</version>
				<executions>
					<execution>
						<phase>compile</phase>
						<goals>
							<goal>java</goal>
						</goals>
						<configuration>
							<!-- Calls the AcceleoCompiler to launch the compilation. -->
							<mainClass>net.fikovnik.projects.taco.latex.AcceleoCompiler</mainClass>
							<arguments>
								<argument>${basedir}/src/</argument>  <!-- The source folder -->
								<argument>${basedir}/target/classes</argument>  <!-- The output folder -->
								<argument>false</argument>  <!-- Indicates if we should use binary resources serializations -->
								<argument>${basedir}/../net.fikovnik.projects.taco.core/src/net/fikovnik/projects/taco/core/gen/files/graphwiz.mtl</argument>  <!-- The project dependencies in the workspace -->
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>


Any help will be appreciated!
Filip
Re: [ACCELEO] Compiling multi-plugin project using maven [message #780811 is a reply to message #780801] Thu, 19 January 2012 08:40 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

The dependency is the path of the project, not the path of the "mtl" file used. You can have a look at what the EEF project does for this (in your case something like "<argument>${basedir}/../net.fikovnik.projects.taco.core</argument> <!-- The project dependencies in the workspace -->" should work).

A maven integration plugin is also coming soon for the next release of Acceleo.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo



Re: [ACCELEO] Compiling multi-plugin project using maven [message #780827 is a reply to message #780811] Thu, 19 January 2012 09:27 Go to previous message
Filip Krikava is currently offline Filip Krikava
Messages: 43
Registered: January 2012
Member
Thanks Stephane a lot for such a quick response.

I tried that and it did not work so I decided to make a sample java application launch in Eclipse to debug it.

In the end the problem was that in my setup I have following plugins:

net.fikovnik.projects.taco.core
net.fikovnik.projects.taco.core.tests


And the AbstractAcceleoCompiler.setDependencies() was picking up the
net.fikovnik.projects.taco.core.tests
instead of
net.fikovnik.projects.taco.core
.

I guess the problem is following code from the
AbstractAcceleoCompiler.setDependencies()
:

for (File candidate : candidates) {
	if (candidate.isDirectory() && candidate.getName() != null
	      && candidate.getName().startsWith(segmentID)) {
			bestRequiredFolder = candidate;
			break;
	}
}


The way the array is sorted it will pick the .test. To fix this I just overwrote the method and changed the condition to:


candidate.isDirectory() && candidate.getName() != null && candidate.getName().equals(segmentID))


I'm not sure what is the motivation behing startsWith(), but this works for me Smile
I'm looking forward the maven plug-in!

/cheers
Filip
Previous Topic:[Acceleo] - Getting started.
Next Topic:Using either globalvardef or property in both workflow and Xpand
Goto Forum:
  


Current Time: Sat Aug 30 08:33:37 EDT 2014

Powered by FUDForum. Page generated in 0.03389 seconds