Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Build Context implementation

Hi,
The source folder notion in eclipse actually means that their contents should be available on build path - that's basically the eclipse's counterpart of cli classpath.
In your case java-template files are just templates that would be turned into real compilable java files. There's no need to add them to build path, and they'll still be picked up by m2e's mojo execution.
Eclipse should also warn you when you edit those generated files residing under target since they have a 'derived' flag.


2014-11-01 23:04 GMT+02:00 Karl Heinz Marbaise <khmarbaise@xxxxxx>:
Hi,

so after reading the page https://wiki.eclipse.org/M2E_compatible_maven_plugins i have worked on a plugin to get an integration with Eclipse...

I tried with mojo codehaus templating-maven-plugin...and a other plugin...

First templating-maven-plugin is a plugin which filters source code...so it's a little more complicated...

https://fisheye.codehaus.org/changelog/mojo/?cs=20112

The problem i'm currently faced with is that this plugin has it sources in src/main/java-templates plus the appropriate package name...
The generated code will be created in target/generated-sources/java-templates...

After the generation of the java files into target/generated-sources/java-templates i have called buildContext.refresh ( outputDirectory)
which tell Eclipse that something has changed in target folder...
which works very well...

But the real problem is that i can't get it to show the real source folder shown correctly in Eclipse...

The folder src/main/java-templates ...in contradiction the folder target/generated/java-templates will be shown as sources folder which seemed to be cause by adding this folder

getMavenProject().addCompileSourceRoot( ... );

If i manually add the src/main/java-templates as a source folder the problem arises that JDT compiles the classes from there automaticially which results in duplicate class messages...

The template plugin already add the folder as compileSourceRoot...which does not implies that the folder is being adding in Eclipse as a source folder...



So the next plugin i have tried to support via buildContext has more or less that same problem...

I can edit the files in Eclipse and simply store and the execution on incremental/configuration will be executed and the result of the generated configuration files can viewed in eclipse also if you
have the generated file already open in Eclipse...

  +-- src
       +--- config
  +-- taget
       + classes
           +--- config

But i can't get to work to get shown the folder src/stage-config being shown as source folder like src/main/resources ?

If i try to go via getMavenProject().addResource()... it will be picked up by maven-resources-plugin... which will cause problems...

I'm not sure where my real problem is located...either a misunderstanding simply a thing or something else...

May be someone has a good idea / hint ?

Kind regards
Karl Heinz Marbaise
_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-dev



--
Regards,
Anton.

Back to the top