You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Miguel Almeida <mi...@almeida.at> on 2012/10/29 12:38:59 UTC

Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

Dear all,

As I was upgrading the maven jetty plugin in a struts archetype, I
noticed a difference in behaviour between versions 6 and 8 of the
plugin. While this might be due to a change in jetty's configuration, I
thought we should check this and probably update the archetypes
accordingly.

Essentially, with version 6, changes in a JSP are automatically seen
(without redeployment) by refreshing the broswer. In version 8, you need
to redeploy the jetty container to see the changes.

Steps to replicate (in either an IDE or command line):

1) Create a maven project with the struts2-blank-archetype 
2) Edit the pom.xml file so the plugin section matches [1]
3) Run the jetty:run maven goal.
4) Open the browser and see the welcome page
5) Edit the file /src/main/webapp/WEB-INF/content/hello.jsp
6) Refresh the browser. You should see the changes immediately

7) Repeat 1-6, but update the plugin section in 2 to the contents listed
below [2]

Expected: Same result as before
Actual: You no longer see the jsp changes upon refreshing the bowser.
You need to restart jetty!


[1] - Version 6 of the plugin. The scantarget element was removed
because we don't want  a complete server redeployment when we just
change a JSP.
        <plugin>

            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.21</version>
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
            </configuration>
        </plugin>

[2] - Version 8 of the plugin. Exact same configuration (except for the artifact's name and version)
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                 <artifactId>jetty-maven-plugin</artifactId>
                 <version>8.1.7.v20120910</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                </configuration>
            </plugin>


Does anyone know what configuration change is needed so you get the same behaviour as before?

Miguel Almeida

Re: Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

Posted by Miguel Almeida <mi...@almeida.at>.
A follow-up on this. I was able to identify the root cause of this
issue. While this is a bit specific to our use case, I share this with
the community nonetheless.

This was basically caused by the timestamps of the files. My work
directory is an NFS mount of another server. For some strange reason*
the clock on that server is delayed. This means that if it's 9:00 and I
change the JSP file, the file will be timestamped with 8:40. 

There might have been a change in Jetty from 6 to 8 regarding the
strategy used for JSP file reloading - while Jetty 6 does not seem to
care about the file's timestamp and refreshes anyway, Jetty 8 is more
sensitive and does not reload the file.

So the "solution" here was simply to update the remote NFS server's
clock. Why the NTP-aware server is having trouble with the time is
another issue...

Miguel Almeida



On Tue, 2012-11-06 at 13:12 +0100, Lukasz Lenart wrote:

> 2012/10/31 Miguel Almeida <mi...@almeida.at>
> 
> > Hey Lukasz,
> >
> > Does your jetty configuration match the ones I provided? More
> > specifically, did you remove the  <scanTargets> element? With
> > scanTargets you will see the JSP changes, but only after the automatic
> > container reload (so, worse case scenario in 10 seconds, as defined in
> > the <scanIntervalSeconds> element.
> >
> > If you remove scanTargets, the page will not be refreshed on JSP change
> > in jetty 8 but will be refreshed in jetty 6! And reloading the entire
> > container for every JSP change seems like an overkill (and slows down
> > development process considerably when your webapp has session variables
> > and security).
> >
> > Could you try the configuration without <scanTargets> for jetty 6 and 8?
> 
> 
> Yes, I did that and even committed the change [1], there was no Jetty
> restarts when I've been changing jsp file.
> 
> [1] https://issues.apache.org/jira/browse/WW-3916
> 
> 
> Regards



Re: Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

Posted by Lukasz Lenart <lu...@apache.org>.
2012/10/31 Miguel Almeida <mi...@almeida.at>

> Hey Lukasz,
>
> Does your jetty configuration match the ones I provided? More
> specifically, did you remove the  <scanTargets> element? With
> scanTargets you will see the JSP changes, but only after the automatic
> container reload (so, worse case scenario in 10 seconds, as defined in
> the <scanIntervalSeconds> element.
>
> If you remove scanTargets, the page will not be refreshed on JSP change
> in jetty 8 but will be refreshed in jetty 6! And reloading the entire
> container for every JSP change seems like an overkill (and slows down
> development process considerably when your webapp has session variables
> and security).
>
> Could you try the configuration without <scanTargets> for jetty 6 and 8?


Yes, I did that and even committed the change [1], there was no Jetty
restarts when I've been changing jsp file.

[1] https://issues.apache.org/jira/browse/WW-3916


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

Re: Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

Posted by Miguel Almeida <mi...@almeida.at>.
Hey Lukasz,

Does your jetty configuration match the ones I provided? More
specifically, did you remove the  <scanTargets> element? With
scanTargets you will see the JSP changes, but only after the automatic
container reload (so, worse case scenario in 10 seconds, as defined in
the <scanIntervalSeconds> element.

If you remove scanTargets, the page will not be refreshed on JSP change
in jetty 8 but will be refreshed in jetty 6! And reloading the entire
container for every JSP change seems like an overkill (and slows down
development process considerably when your webapp has session variables
and security).

Could you try the configuration without <scanTargets> for jetty 6 and 8?

Miguel Almeida


On Tue, 2012-10-30 at 21:57 +0100, Lukasz Lenart wrote:

> Hi,
> 
> I've tested with apps/blank and it works as expected, the same with an
> app created base on struts2-archetype-blank (mvn archetype:generate -
> 307) and base on struts2-archetype-convention (308). No problems
> spotted :-)
> 
> 
> Kind regards



Re: Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

Posted by Lukasz Lenart <lu...@apache.org>.
Hi,

I've tested with apps/blank and it works as expected, the same with an
app created base on struts2-archetype-blank (mvn archetype:generate -
307) and base on struts2-archetype-convention (308). No problems
spotted :-)


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2012/10/29 Miguel Almeida <mi...@almeida.at>:
> Dear all,
>
> As I was upgrading the maven jetty plugin in a struts archetype, I
> noticed a difference in behaviour between versions 6 and 8 of the
> plugin. While this might be due to a change in jetty's configuration, I
> thought we should check this and probably update the archetypes
> accordingly.
>
> Essentially, with version 6, changes in a JSP are automatically seen
> (without redeployment) by refreshing the broswer. In version 8, you need
> to redeploy the jetty container to see the changes.
>
> Steps to replicate (in either an IDE or command line):
>
> 1) Create a maven project with the struts2-blank-archetype
> 2) Edit the pom.xml file so the plugin section matches [1]
> 3) Run the jetty:run maven goal.
> 4) Open the browser and see the welcome page
> 5) Edit the file /src/main/webapp/WEB-INF/content/hello.jsp
> 6) Refresh the browser. You should see the changes immediately
>
> 7) Repeat 1-6, but update the plugin section in 2 to the contents listed
> below [2]
>
> Expected: Same result as before
> Actual: You no longer see the jsp changes upon refreshing the bowser.
> You need to restart jetty!
>
>
> [1] - Version 6 of the plugin. The scantarget element was removed
> because we don't want  a complete server redeployment when we just
> change a JSP.
>         <plugin>
>
>             <groupId>org.mortbay.jetty</groupId>
>             <artifactId>maven-jetty-plugin</artifactId>
>             <version>6.1.21</version>
>             <configuration>
>                 <scanIntervalSeconds>10</scanIntervalSeconds>
>             </configuration>
>         </plugin>
>
> [2] - Version 8 of the plugin. Exact same configuration (except for the artifact's name and version)
>             <plugin>
>                 <groupId>org.mortbay.jetty</groupId>
>                  <artifactId>jetty-maven-plugin</artifactId>
>                  <version>8.1.7.v20120910</version>
>                 <configuration>
>                     <scanIntervalSeconds>10</scanIntervalSeconds>
>                 </configuration>
>             </plugin>
>
>
> Does anyone know what configuration change is needed so you get the same behaviour as before?
>
> Miguel Almeida

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org