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 215089 - Maven COS no longer works
Summary: Maven COS no longer works
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-02 17:24 UTC by akochnev
Modified: 2012-07-10 07:41 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sample app (84.64 KB, application/x-zip-compressed)
2012-07-03 13:23 UTC, akochnev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description akochnev 2012-07-02 17:24:26 UTC
The Maven "Compile-on-save"/Copy-on-save support no longer works. 

Basic steps to verify:
* Create a simple maven project web application that has some classes in src/main/java and some resources in src/main/resources. 
* Change the "Compile on Save" setting in NetBeans to "on application and test execution". 
* Change a java class in src/main/java/my/package/name/Foo.java or a resource in src/main/resources/my/package/name/Foo.properties. 

The expected result is that an updated .class file would show up in target/{web_app_name}/WEB-INF/classes/my/package/name/Foo.class or target/{web_app_name}/WEB-INF/classes/my/package/name/Foo.properties would be updated. 

In 7.1, the class/property file are updated in the target directory tree. In 7.2 RC1, they aren't. 

This is a BIG deal and a major productivity killer for 7.2
Comment 1 Jiri Skrivanek 2012-07-03 08:28:38 UTC
I can confirm it is reproducible in NetBeans 7.2 RC1 as described. Deploy on save works as expected.
Comment 2 Petr Hejl 2012-07-03 09:45:18 UTC
The class file update works ok. Please specify complete steps to reproduce. I'm missing build or run step. Without that it never worked even in 7.1.

I can just confirm property file is consistently failing to be updated.
Comment 3 Petr Hejl 2012-07-03 12:14:24 UTC
I tested following:
1) create maven web project targeting GF
2) create servlet
3) invoke build
4) change sevlet

In 7.1 class file in target/classes was properly updated and in target/{web_app_name}/WEB-INF/classes was not updated.

In 7.2 class file in target/classes was properly updated and in target/{web_app_name}/WEB-INF/classes was not updated.

So there is no change.

I'll check the property files.
Comment 4 Petr Hejl 2012-07-03 12:23:13 UTC
(In reply to comment #3)
> I'll check the property files.

The same scenario with property file:
In 7.1 property file in target/classes was properly updated and in
target/{web_app_name}/WEB-INF/classes was updated as well.

In 7.2 property file in target/classes was not properly updated and in
target/{web_app_name}/WEB-INF/classes was not updated as well.

This regression on property file seems to be caused by: http://hg.netbeans.org/web-main/rev/079cf785d749
Comment 5 Petr Hejl 2012-07-03 12:52:55 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > I'll check the property files.
> 
> The same scenario with property file:
> In 7.1 property file in target/classes was properly updated and in
> target/{web_app_name}/WEB-INF/classes was updated as well.
> 
> In 7.2 property file in target/classes was not properly updated and in
> target/{web_app_name}/WEB-INF/classes was not updated as well.
> 
> This regression on property file seems to be caused by:
> http://hg.netbeans.org/web-main/rev/079cf785d749
Correction: property file is broken on every even Build in 7.2.
Comment 6 akochnev 2012-07-03 13:23:35 UTC
Created attachment 121700 [details]
sample app

Sample Tapestry 5 application illustrating the issue
Comment 7 akochnev 2012-07-03 13:24:13 UTC
I created the following simple project by running the Tapestry 5 Getting Started guide (http://tapestry.apache.org/getting-started.html) , e.g:
 mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org

and selecting the org.apache.tapestry:quickstart, version 5.3.3

I opened the project in NetBeans 7.1. I went to the project properties and selected COS for application and test execution. For a good measure, I ran the build from the IDE. 

Then, on the command line, I ran "mvn jetty:run" and navigated to http://localhost:8080/nb_cos (to see if my changes are being picked up by jetty). 

1. I changed the src\main\resources\org\nb\nb_cos\pages\Index.tml and src\main\resources\org\nb\nb_cos\pages\Index.properties and src\main\java\org\nb\nb_cos\pages\Index.java . 

In 7.1, I saw all three files (.tml, .properties and the .class) get immediately updated in both classes directories (target\classes\org\nb\nb_cos\pages and target\nb_cos\WEB-INF\classes\org\nb\nb_cos\pages)

In 7.2, changing the .tml,  and .properties file doesn't propagate the changes to the classes directories. The change to .java does propagate to the classes directories.
Comment 8 Petr Hejl 2012-07-03 14:22:40 UTC
Fixed in web-main de42943d36ef.

Milosi, please review the fix one other change I had to made is to add _recursive_ listener.

akochnev thanks for the detail description!

Jirko can you please verify?

Martine, this was not actually caused by your change as I stated in comment #4. Sorry for that.
Comment 9 Milos Kleint 2012-07-03 15:22:20 UTC
(In reply to comment #8)
> Fixed in web-main de42943d36ef.
> 
> Milosi, please review the fix one other change I had to made is to add
> _recursive_ listener.

Looks good to me.
Comment 10 David Konecny 2012-07-03 18:24:05 UTC
(In reply to comment #8)
> Martine, this was not actually caused by your change as I stated in comment #4.

So which change caused this "regression"? If this used to work in 7.1 we had to change something in 7.2, right? I'm just curious what it was.
Comment 11 Petr Hejl 2012-07-03 19:49:32 UTC
(In reply to comment #10)
> (In reply to comment #8)
> > Martine, this was not actually caused by your change as I stated in comment #4.
> 
> So which change caused this "regression"? If this used to work in 7.1 we had to
> change something in 7.2, right? I'm just curious what it was.

2dd85d25f17b
fc6088a2c096
Comment 12 Quality Engineering 2012-07-04 03:09:01 UTC
Integrated into 'main-golden', will be available in build *201207040002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/de42943d36ef
User: Petr Hejl <phejl@netbeans.org>
Log: #215089 Maven COS no longer works
Comment 13 Jiri Skrivanek 2012-07-04 06:25:42 UTC
It doesn't work for me in dev build 201207040002. It might be caused by bug 214182. I did the following:

- create maven web project with GlassFish server
- create servlet
- create html
- create properties in resources
- build project
- facing bug 214182 - exceptions are thrown repeatedly (http://statistics.netbeans.org/exceptions/exception.do?id=597704)
- change and save servlet => class neither updated in target/classes nor in WEB-INF/classes; sometimes it is cleaned from target/classes after save
- change and save properties => properly updated in both locations
- change and save html => properly updated in both locations
Comment 14 Milos Kleint 2012-07-04 07:57:55 UTC
(In reply to comment #13)
> It doesn't work for me in dev build 201207040002. It might be caused by bug
> 214182. I did the following:
> 
> - create maven web project with GlassFish server
> - create servlet
> - create html
> - create properties in resources
> - build project
> - facing bug 214182 - exceptions are thrown repeatedly
> (http://statistics.netbeans.org/exceptions/exception.do?id=597704)

not facing this on macosx and most likely unrelated, cannot see how the change by phejl could have broken this.

> - change and save servlet => class neither updated in target/classes nor in
> WEB-INF/classes; sometimes it is cleaned from target/classes after save

I see something different here. The 2 significant locations are target/classes and target/mavenproject1-1.0-SNAPSHOT/WEB-INF/classes. I see the class being updated in the first location (that's where the java support copies it) but the classes are not appearing in the expanded web app folder, that copying is done someplace in the websupport?

> - change and save properties => properly updated in both locations
> - change and save html => properly updated in both locations

+1 both locations are updating for me. That's what has been fixed by the patch by phejl AFAIK.
Comment 15 Milos Kleint 2012-07-04 08:13:01 UTC
From what I can see, the basic
Comment 16 Petr Hejl 2012-07-04 08:39:54 UTC
Fixed project closing web-main 854f509aa955.
Comment 17 Petr Hejl 2012-07-04 08:52:04 UTC
(In reply to comment #14)
> (In reply to comment #13)

> I see something different here. The 2 significant locations are target/classes
> and target/mavenproject1-1.0-SNAPSHOT/WEB-INF/classes. I see the class being
> updated in the first location (that's where the java support copies it) but the
> classes are not appearing in the expanded web app folder, that copying is done
> someplace in the websupport?
> 
See my comment #3 it does not work even in 7.1 and I think it is this way from the very beginning:

In 7.1 class file in target/classes was properly updated and in
target/{web_app_name}/WEB-INF/classes was not updated.

So we definitely don't want to fix this part in HR if we want to fix it at all.

Though the usecase reported in comment #7 now perfectly works for me (even the class file). I guess embedded jetty is looking for fresh classes in target/classes.
Comment 18 Petr Hejl 2012-07-04 08:52:46 UTC
akochnev, can you verify with your use case?
Comment 19 Petr Hejl 2012-07-04 09:00:21 UTC
(In reply to comment #15)
> From what I can see, the basic
Milosi is something missing here? Any details?
Comment 20 Milos Kleint 2012-07-04 09:04:24 UTC
(In reply to comment #19)
> (In reply to comment #15)
> > From what I can see, the basic
> Milosi is something missing here? Any details?

written in error, no idea what I meant or what it happened.
Comment 21 Petr Hejl 2012-07-04 09:08:00 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > (In reply to comment #15)
> > > From what I can see, the basic
> > Milosi is something missing here? Any details?
> 
> written in error, no idea what I meant or what it happened.

Ok. The issue #214182 seems to be completely unrelated to this one or to the recent changes. Any idea how this could happen.

Jirko, can you work around it and verify this one?
Comment 22 Petr Hejl 2012-07-04 09:28:33 UTC
I've just tested on Linux and Windows and works ok for me. I'll try with windows and long username ;)
Comment 23 Jiri Skrivanek 2012-07-04 09:37:19 UTC
If bug 214182 doesn't appear, it works in dev build 201207040002. Tested:

- create maven web project with GlassFish server
- create servlet
- create html
- create properties in resources
- build project
- change and save servlet => class updated in target/classes
                          => class not updated in WEB-INF/classes
- change and save properties => properly updated in both locations
- change and save html => properly updated in both locations
Comment 24 Petr Hejl 2012-07-04 10:30:49 UTC
I tested with -J-da and everything works. Do we agree that this issue is fixed?
Comment 25 Jiri Skrivanek 2012-07-04 10:41:41 UTC
Yes, it is fixed.
Comment 26 akochnev 2012-07-05 14:51:33 UTC
I downloaded 

Confirmed that the changes to the resources are being propagated to both target\classes and target\${web_app_name}\WEB-INF\classes. 

Changes to java classes do propagate to the class files in target\classes but not to the classes in target\${web_app_name}\WEB-INF\classes. 

I understand that the discrepancy (e.g. resources showing up in both places, class files only in one) is expected behavior (as discussed in the ticket) ; however, is this how it really should be (maybe I should file another ticket for post-7.2?) ?

Also, I noticed that when I initially opened the project, the COS behavior didn't start until I ran a maven build from the IDE. What is the trigger for COS to start working ?
Comment 27 Milos Kleint 2012-07-05 15:12:55 UTC
(In reply to comment #26)
> Also, I noticed that when I initially opened the project, the COS behavior
> didn't start until I ran a maven build from the IDE. What is the trigger for
> COS to start working ?


for classes it's presence of .netbeans_automatic_build file in target/classes. Which is checked and set after each build (clean could have deleted it, so we need to reinsert it). 
It's more or less by design, the assumption is that you always have to start some "Run" related action in order for the CoS to make sense.
Comment 28 Quality Engineering 2012-07-06 03:15:29 UTC
Integrated into 'main-golden', will be available in build *201207060002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/854f509aa955
User: Petr Hejl <phejl@netbeans.org>
Log: #215089 Maven COS no longer works
Comment 29 Petr Hejl 2012-07-07 08:28:08 UTC
Pushed to release72 as b75de5440c30 and 8e97882eeaf0.
Comment 30 Quality Engineering 2012-07-10 06:43:29 UTC
Integrated into 'releases', will be available in build *201207092359* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/b75de5440c30
User: Petr Hejl <phejl@netbeans.org>
Log: #215089 Maven COS no longer works
Comment 31 Jiri Skrivanek 2012-07-10 07:41:24 UTC
Verified in NetBeans IDE 7.2 (Build 201207092359).