Dynamic profile not detected on second maven execution [message #1742858] |
Thu, 08 September 2016 09:04  |
pere joseph rodríguez Messages: 47 Registered: October 2014 |
Member |
|
|
Hi,
I've got two main acceleo generators on the same plugin, packaged as a maven generator, but when running the generator from maven, the second generator does not detect the dynamically registered profiles.
Don't know if is a bug... on the second execution the profiles are already registered, so it don't get registered two times.
My code to register dynamic profiles:
private void registerProfile(ResourceSet resourceSet, URI uri) {
Resource profileResource = resourceSet.getResource(uri, true);
Profile profile=((Profile)EcoreUtil.getObjectByType(profileResource.getContents(),UMLPackage.Literals.PROFILE));
if(profile.getURI()!=null){
if(UMLPlugin.getEPackageNsURIToProfileLocationMap().get(profile.getURI().toString())==null){
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(profile.getURI().toString(),URI.createURI((EcoreUtil.getURI(profile.getDefinition()).toString().replaceAll("\\\\","/")) ) );
}
if(resourceSet.getPackageRegistry().get(profile.getURI().toString())==null){
resourceSet.getPackageRegistry().put(profile.getURI().toString(),URI.createURI((EcoreUtil.getURI(profile.getDefinition()).toString().replaceAll("\\\\","/")) ) );
}
System.out.println("-- Registering profile "+profile.getURI().toString()+" ("+URI.createURI((EcoreUtil.getURI(profile.getDefinition()).toString().replaceAll("\\\\","/")) )+")");
}
}
My Maven generator launcher:
<plugin>
<groupId>org.eclipse.acceleo</groupId>
<artifactId>org.eclipse.acceleo.maven.launcher</artifactId>
<version>${acceleo.maven.launcher.version}</version>
<executions>
<execution>
<id>generate-jboss-ejb</id>
<phase>process-resources</phase>
<goals>
<goal>acceleo-launcher</goal>
</goals>
<configuration>
<generatorClass>org.eclipse.acceleo.module.test.main.GenerateJbossEjbXml</generatorClass>
<model>${generators.source.model}</model>
<outputFolder>${generators.target.folder}</outputFolder>
<failOnError>true</failOnError>
</configuration>
</execution>
<execution>
<id>generate-jboss-web</id>
<phase>process-resources</phase>
<goals>
<goal>acceleo-launcher</goal>
</goals>
<configuration>
<generatorClass>org.eclipse.acceleo.module.test.main.GenerateJbossWebXml</generatorClass>
<model>${generators.source.model}</model>
<outputFolder>${generators.target.folder}</outputFolder>
<failOnError>true</failOnError>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.test.mof2text</groupId>
<artifactId>org.eclipse.acceleo.module.test</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
Thanks for anny suggestion.
|
|
|
|
Re: Dynamic profile not detected on second maven execution [message #1743020 is a reply to message #1742859] |
Fri, 09 September 2016 14:00  |
|
Hi,
You're using UML, so first things first are you using UMLResourcesUtil.init(resourceSet) on the resource set you use?
Other than that, are you sure you're using the same resource set for both generations? If not you will have to re-register your profile in the second one.
If none of these helps, please provide us with a way to reproduce the issue.
Laurent Goubet
|
|
|
Powered by
FUDForum. Page generated in 0.02402 seconds