This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 217722 - Maven Filtered resources not taken into account when running prog from the IDE (working in 7.1.2
Summary: Maven Filtered resources not taken into account when running prog from the ID...
Status: RESOLVED INCOMPLETE
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 215594
Blocks:
  Show dependency tree
 
Reported: 2012-09-03 08:07 UTC by pdeville
Modified: 2012-11-05 12:45 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (66.51 KB, text/plain)
2012-09-03 08:07 UTC, pdeville
Details
description and bug details for mcalderoni (4.04 KB, text/plain)
2012-10-23 22:23 UTC, massimo
Details
zip file containing a sample maven project reproducing the issue (3.50 KB, application/octet-stream)
2012-10-23 22:25 UTC, massimo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pdeville 2012-09-03 08:07:25 UTC
I am using maven project in a swing based application, in that application i have a property file with filtered resource (Containing property from the pom). 
In that file I have "main.dao.factory.env = ${dao.factory.url}"
In the jar generated by maven the property file contains the write value (main.dao.factory.env = oracle.jdbc.driver.OracleDriver...)
But when running it the it contains the original file (not filtered :   "main.dao.factory.env = ${dao.factory.url}")

Product Version = NetBeans IDE 7.2 (Build 201207171143)
Operating System = Linux version 3.0.0-12-generic running on amd64
Java; VM; Vendor = 1.6.0_31
Runtime = Java HotSpot(TM) 64-Bit Server VM 20.6-b01
Comment 1 pdeville 2012-09-03 08:07:30 UTC
Created attachment 123810 [details]
IDE log
Comment 2 Milos Kleint 2012-09-05 06:34:23 UTC
I suppose the problem is caused by Compile on Save being turned ON in 7.2. That one doesn't process filtered resources. You can disable it in project's properties dialog.
In 7.3 it will be again disabled by default.
Comment 3 pdeville 2012-09-13 05:27:45 UTC
When compile on save is disable then the problem doesn't appear. it uses the resources generated in the target directory
Comment 4 Milos Kleint 2012-10-01 13:31:10 UTC
issue 214828 is related. Filtered resources are not supported(-able) by various pieces of the IDE but it's not obvious enough.
Comment 5 Milos Kleint 2012-10-23 06:08:08 UTC
it appears that we attempt to catch any changes in filtered resource roots and when we find one we execute a non-CoS Run (meaning a maven build based Run that will copy filtered resources)

Can you share your project? so That I can inspect why this one fell through the net? or create a similar sample project? thank you.
Comment 6 massimo 2012-10-23 22:23:20 UTC
Created attachment 126416 [details]
description and bug details for mcalderoni
Comment 7 massimo 2012-10-23 22:25:29 UTC
Created attachment 126417 [details]
zip file containing a sample maven project reproducing the issue

Confirming that with project compile not set on save it will not happen.

Attaching my detailed description, for the record (but is the same as described here), and a maven project reproducing the issue (please note that paths are hardcoded of course in nbactions.xml): by running Main with "compile on save" turned on, you will see the string "${project.build.directory}" instead of a path.
Comment 8 Milos Kleint 2012-10-24 13:30:27 UTC
I cannot reproduce with the provided sample project, I've changed the paths in nbactions.xml to point to my location of the project, made sure the CoS is on and clean built the application.

1. on every conf file edit+save, I've verified that the file in target/classes was not changed
2. The Run project action invoked after such edit always ran Maven, not CoS' Ant build.
3. Another Run project without edit already triggered Cos Ant build. Both Maven and Ant builds showed correct resolved path..
4. I've tried swapping the 2 <resource> declarations in the pom file but again, it was working fine.
Comment 9 massimo 2012-10-24 22:30:26 UTC
Weird thing. But I have also noticed myself that not happening consistently. Then must be something outside of NetBeans, although it is hard to see how and why. Will provide more info if i can get a clue.
Comment 10 Milos Kleint 2012-11-05 12:45:19 UTC
ok, closing as incomplete for now, please reopen once you manage to collect more details about the problem, thank you.