Thank you for your idea. But actually this solution is not what I want due to two reasons: (a) Loading a resource needs more execution time and produces bigger footprint than simply show a static string. (b) If I would want to do that, I could simply load pom.properties which is packed into a JAR by maven automatically.
So what I actually like to know is, how m2e is intended to deal with filtered sources (or if one must not use filtered sources definitively)?
Von: m2e-users-bounces@xxxxxxxxxxx [mailto:m2e-users-bounces@xxxxxxxxxxx] Im Auftrag von Fred Bricon
Gesendet: Dienstag, 3. Juli 2012 12:57
An: Maven Integration for Eclipse users mailing list
Betreff: Re: [m2e-users] Cannot edit filtered source files
You should instead put that ${project.version} placeholder in a properties file in src/main/resources, activate filtering and load that properties in your java classes
On Tue, Jul 3, 2012 at 12:32 PM, Markus Karg <karg@xxxxxxxxx> wrote:
What I actually want to achieve is:
* I can edit a Java file in Eclipse using JDT.
* When Maven is compiling it (mvn compile) it shall replace ${project.version} placeholders found in the java source (those are needed e. g. to display the current version in the splash screen and about dialog of my application).
Isn't the solution I implemented the correct way to do this in mvn / m2e?
Thanks!
Markus
-----Ursprüngliche Nachricht-----
Von: m2e-users-bounces@xxxxxxxxxxx [mailto:m2e-users-bounces@xxxxxxxxxxx] Im Auftrag von Rafal Krzewski
Gesendet: Dienstag, 3. Juli 2012 12:17
An: Maven Integration for Eclipse users mailing list
Betreff: Re: [m2e-users] Cannot edit filtered source files
Well, you are asking for the raw (unfiltered) source files to be on the classpath (so that JDT can work on them) and NOT be on the classpath at the same time, so that they don't clash with the filtering output.
Obviously this cannot work. Why are you trying to filter the sources in the first place?
regards,
Rafał
On Tue 03 Jul 2012 08:49:18 AM CEST, Markus Karg wrote:
> Hello m2e Community,
>
> I have a problem with filtered source files and I hope you know how to
> fix it.
>
> I am editing a simple Java project in Eclipse which worked rather well
> until I enabled to filter resources by the following POM entry:
>
> <sourceDirectory>target/filtered-sources/java</sourceDirectory>
>
> <resources>
>
> <resource>
>
> <directory>src/main/resources</directory>
>
> </resource>
>
> <resource>
>
> <directory>src/main/java</directory>
>
> <filtering>true</filtering>
>
> <targetPath>../filtered-sources/java</targetPath>
>
> </resource>
>
> </resources>
>
> After “Maven > Update Project…” the situation in Eclipse is:
>
> ·/target/filtered-sources/java is correctly treated as a derived
> source file, i. e. Eclipse warns that all changes are lost as the file
> gets recreated automatically by the filtering. I think this is OK and
> wanted.
>
> ·But: /src/main/java’s content is shown with a different (shallow) “J”
> icon, and Eclipse cannot apply neither “Organize Import” nor “Source >
> Format” operations. For example, when trying “Organize Import”,
> Eclipse Indigo says “The resource is not on the build path of a Java
> project.”. Well, in fact, it actually IS on the build path, but it is
> EXCLUDED by “**” by m2e (at least the package explorer tells me). This
> means, all the nice JDT gimmicks are switched off!
>
> So editing the original source is rather impossible now! I do not
> believe that it is wanted by m2e that I cannot use any of the JDT
> gimmicks?
>
> What am I doing wrong?
>
> Thanks!
>
> Markus
>
>
>
> _______________________________________________
> m2e-users mailing list
> m2e-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-users
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
--
"Have you tried turning it off and on again" - The IT Crowd