Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] jetty-maven-plugin, war overlay and hot redeploy

Ivan,

The <webApp> that is configured is a subclass of the standard
o.e.j.w.WebAppContext, therefore you can call any of the
single-argument setters that exist on it, or indeed any of that
class's superclasses. See
http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/webapp/WebAppContext.html

cheers
Jan

On 2 October 2014 11:43, Ivan Savchenko <ivan.a.savchenko@xxxxxxxxx> wrote:
> Jan,
>
> Thanks, but I don't see extraClassPath parameter in 9.2.3.v20140905 version
> of plugin. I checked documentation here
> http://www.eclipse.org/jetty/documentation/9.2.3.v20140905/jetty-maven-plugin.html
> Is this parameter have another name? Or is there another way to specify
> additional classpath? As I understand classesDirectory parameter is for
> dependent war, not the dependency one.
>
> Thanks,
> Ivan
>
> On 2 October 2014 14:02, Jan Bartel <janb@xxxxxxxxxxx> wrote:
>>
>> Ivan,
>>
>> Re my previous posting, I can confirm that what I described works in
>> jetty: if the dependency war changes in local maven repo  jetty will
>> redeploy, re-unpack it and use the changed static resources, classes
>> etc.
>>
>> Having re-re-read your stackoverflow post, I think I see the problem:
>> the plugin is using the classes and resources from your dependency
>> war, NOT from the <scanTarget> that you have added. The <scanTarget>
>> simply tells jetty to watch that location and redeploy if something in
>> it changes.
>>
>> So you need to tell jetty to use the classes and resources from your
>> dependency war's project, NOT the war artifact.
>>
>> So do something like:
>>
>> <plugin>
>>     <groupId>org.eclipse.jetty</groupId>
>>     <artifactId>jetty-maven-plugin</artifactId>
>>     <version>9.2.3.v20140905</version>
>>     <configuration>
>>         <webApp>
>>             <!-- tell jetty to use the classes from the dependency
>> webapp project directly -->
>>
>> <extraClassPath>${basedir}/../SharedWeb/target/classes</extraClassPath>
>>
>>            <!-- tell jetty to use both this project's static
>> resources, and those of the dependency webapp project -->
>>            <resourceBases>
>>                <directory>${basedir}/src/main/webapp</directory>
>>
>> <directory>${basedir}/../SharedWeb/src/main/webapp</directory>
>>            </resourceBases>
>>         </webApp>
>>         <scanIntervalSeconds>3</scanIntervalSeconds>
>>        <!-- tell jetty to watch the dependency webapp project classes
>> dir for changes -->
>>         <scanTargets>
>>
>> <scanTarget>${basedir}/../SharedWeb/target/classes/</scanTarget>
>>         </scanTargets>
>>     </configuration>
>>   </plugin>
>>
>>
>> Jan
>>
>> On 2 October 2014 10:28, Jan Bartel <janb@xxxxxxxxxxx> wrote:
>> > Ivan,
>> >
>> > To be clear about what you're reporting:  you are saying that when you
>> > change static resources or classes from inside a dependency war, then
>> > re-make that war and install it to your maven repo, jetty
>> > automatically restarts but you are seeing old static resources and
>> > classes? Even after doing a full and proper refresh of your browser
>> > page (ie eliminated browser caching?)
>> >
>> > thanks
>> > Jan
>> >
>> > On 2 October 2014 10:06, Ivan Savchenko <ivan.a.savchenko@xxxxxxxxx>
>> > wrote:
>> >> Hi Joakim,
>> >>
>> >> Thanks for your reply. I commented on your stackoverlow answer, but not
>> >> sure
>> >> if you saw my question, so I just duplicate it in e-mail:
>> >>
>> >> I've tried this configuration (removed recoureBases) and I found that
>> >> reload
>> >> doesn't work for both resources and classes. When I change resource
>> >> (like
>> >> html) or recompile class (changing just method body), embed jetty is
>> >> getting
>> >> restarted and after restart it uses old resources and classes, which
>> >> are
>> >> probably taken from artefact from maven local repository. Could it be a
>> >> bug?
>> >> I'll appreciate any tips to debug this issue
>> >>
>> >> On 2 October 2014 10:23, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
>> >>>
>> >>> Answered at
>> >>>
>> >>> http://stackoverflow.com/questions/26150681/how-to-hot-redeploy-non-active-maven-project-via-jetty-maven-plugin
>> >>>
>> >>> --
>> >>> Joakim Erdfelt <joakim@xxxxxxxxxxx>
>> >>> webtide.com - intalio.com/jetty
>> >>> Expert advice, services and support from from the Jetty & CometD
>> >>> experts
>> >>> eclipse.org/jetty - cometd.org
>> >>>
>> >>> On Tue, Sep 30, 2014 at 10:36 PM, Ivan Savchenko
>> >>> <ivan.a.savchenko@xxxxxxxxx> wrote:
>> >>>>
>> >>>> Hi guys,
>> >>>>
>> >>>> I'm trying to evaluate jetty for rapid development or project which
>> >>>> is
>> >>>> currently running on tomcat. My configuration looks like
>> >>>>
>> >>>>             <plugin>
>> >>>>                 <groupId>org.eclipse.jetty</groupId>
>> >>>>                 <artifactId>jetty-maven-plugin</artifactId>
>> >>>>                 <version>9.2.3.v20140905</version>
>> >>>>                 <configuration>
>> >>>>                     <scanIntervalSeconds>3</scanIntervalSeconds>
>> >>>>                     <webApp>
>> >>>>
>> >>>>
>> >>>> <descriptor>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</descriptor>
>> >>>>                         <resourceBases>
>> >>>>
>> >>>> <directory>${basedir}/src/main/webapp</directory>
>> >>>>
>> >>>> <directory>${basedir}/../SharedWeb/src/main/webapp</directory>
>> >>>>                         </resourceBases>
>> >>>>
>> >>>> <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
>> >>>>                         <contextPath>/test</contextPath>
>> >>>>                     </webApp>
>> >>>>                 </configuration>
>> >>>>             </plugin>
>> >>>>
>> >>>> I have main war depending on SharedWeb war via war overlay mechanism.
>> >>>> I
>> >>>> specify resourceBases for both maven projects so changes in resources
>> >>>> are
>> >>>> scanned automatically and reloaded on the fly and all working fine.
>> >>>> Also
>> >>>> when I compile classes in main war, jetty restarts automatically,
>> >>>> reloading
>> >>>> the latest changes. But when I try to change any class in SharedWeb
>> >>>> project
>> >>>> and compile it, the class is not reloaded. I'm just wondering if
>> >>>> there is a
>> >>>> way to make embed jetty to reload classes from SharedWeb
>> >>>> automatically? I
>> >>>> understand that jetty-maven-plugin uses SharedWeb war from local
>> >>>> maven
>> >>>> repository, so I need to install SharedWeb artifact before I can see
>> >>>> any
>> >>>> changes. So I don't have high expectations, but maybe I'm missing
>> >>>> something.
>> >>>>
>> >>>> Thanks.
>> >>>>
>> >>>> --
>> >>>> Kind regards,
>> >>>> Ivan
>> >>>>
>> >>>> _______________________________________________
>> >>>> jetty-users mailing list
>> >>>> jetty-users@xxxxxxxxxxx
>> >>>> To change your delivery options, retrieve your password, or
>> >>>> unsubscribe
>> >>>> from this list, visit
>> >>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>> >>>
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> jetty-users mailing list
>> >>> jetty-users@xxxxxxxxxxx
>> >>> To change your delivery options, retrieve your password, or
>> >>> unsubscribe
>> >>> from this list, visit
>> >>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Kind regards,
>> >> Ivan
>> >>
>> >> _______________________________________________
>> >> jetty-users mailing list
>> >> jetty-users@xxxxxxxxxxx
>> >> To change your delivery options, retrieve your password, or unsubscribe
>> >> from
>> >> this list, visit
>> >> https://dev.eclipse.org/mailman/listinfo/jetty-users
>> >
>> >
>> >
>> > --
>> > Jan Bartel <janb@xxxxxxxxxxx>
>> > www.webtide.com
>> > 'Expert Jetty/CometD developer,production,operations advice'
>>
>>
>>
>> --
>> Jan Bartel <janb@xxxxxxxxxxx>
>> www.webtide.com
>> 'Expert Jetty/CometD developer,production,operations advice'
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
>
>
> --
> Kind regards,
> Ivan
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users



-- 
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'


Back to the top