You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ilya Obshadko <il...@gmail.com> on 2014/07/09 22:38:04 UTC

[T5.4] split Tapestry application into separate modules

I would like to modularize my application into several modules, so that
each one of them would be a separate Maven artifact. I'm trying to
reproduce what I can borrow from tapestry-upload module source, but still
have questions:

- component that was moved into separate module can't be loaded by main
application using standard namespace; is there any way to fix that? (that
is, <t:mycomponent/> results in UknownValueException);
contributeComponentClassResolver() (like in tapestry-upload) doesn't help
(or I just use it incorrectly)

- is that possible to run the whole thing within Eclipse without having to
install 'module' project into local repository?

Thanks in advance.

-- 
Ilya Obshadko

Re: [T5.4] split Tapestry application into separate modules

Posted by Daniel Jue <te...@gmail.com>.
I think in T 5.4 @Submodule has been deprecated in favor of @ImportModule


On Wed, Jul 9, 2014 at 6:05 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Wed, 09 Jul 2014 17:38:04 -0300, Ilya Obshadko <il...@gmail.com>
> wrote:
>
>  - component that was moved into separate module can't be loaded by main
>> application using standard namespace; is there any way to fix that? (that
>> is, <t:mycomponent/> results in UknownValueException);
>>
>
> That's expected: When you changed the component from the application to a
> component library, you've changed its namespace. You can advise or decorate
> ComponentClassResolver.resolveComponentTypeToClassName() and
> resolveMixinTypeToClassName() (for mixins), which are the methods which map
> logical names to component or mixin class names.
>
>
>  - is that possible to run the whole thing within Eclipse without having
>> to install 'module' project into local repository?
>>
>
> Yes. Just make sure the webapp module has the component modules in its
> classpath. Module class autoloading won't work, as there's no JAR for the
> component libraries included in this way, but then you can use the
> tapestry.modules VM argument to specify comma-separated fully qualified
> module class names to be loaded. Another option is to use @Submodule in
> your AppModule.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5.4] split Tapestry application into separate modules

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 10 Jul 2014 11:56:07 -0300, Ilya Obshadko  
<il...@gmail.com> wrote:

> Thanks Thiago, I'll give it a try (currently I'm using jetty:run and  
> until this moment I had no problems with it).

jetty:run is slower to start, doesn't find the sources of most external  
code even when available and doesn't handle live changes to assets very  
well. RunJettyRun is faster, finds all available sources when debugging  
and it's way easier to configure.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.4] split Tapestry application into separate modules

Posted by Ilya Obshadko <il...@gmail.com>.
Thanks Thiago, I'll give it a try (currently I'm using jetty:run and until
this moment I had no problems with it).


On Thu, Jul 10, 2014 at 4:43 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> What are you using to launch the webapp? I recommend the RunJettyRun
> plugin. Way better than jetty:run, if you ask me.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Ilya Obshadko

Re: [T5.4] split Tapestry application into separate modules

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
What are you using to launch the webapp? I recommend the RunJettyRun  
plugin. Way better than jetty:run, if you ask me.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.4] split Tapestry application into separate modules

Posted by Ilya Obshadko <il...@gmail.com>.
Thanks guys!

I have successfully resolved the problem with component loading by
introducing another namespace (just like tapestry-jquery does); I have
concluded it would be better than messing with Tapestry core namespace.

But I still have problems with picking up changes in component library at
runtime. I've been trying to configure it using VM arguments and pom.xml
properties, but unsuccessfully.

This setting

            <systemProperty>
              <name>tapestry.modules</name>
              <value>my.package.name.ModuleName</value>
            </systemProperty>

in main application configuration doesn't work.



On Thu, Jul 10, 2014 at 12:05 AM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Wed, 09 Jul 2014 17:38:04 -0300, Ilya Obshadko <il...@gmail.com>
> wrote:
>
>  - component that was moved into separate module can't be loaded by main
>> application using standard namespace; is there any way to fix that? (that
>> is, <t:mycomponent/> results in UknownValueException);
>>
>
> That's expected: When you changed the component from the application to a
> component library, you've changed its namespace. You can advise or decorate
> ComponentClassResolver.resolveComponentTypeToClassName() and
> resolveMixinTypeToClassName() (for mixins), which are the methods which map
> logical names to component or mixin class names.
>
>
>  - is that possible to run the whole thing within Eclipse without having
>> to install 'module' project into local repository?
>>
>
> Yes. Just make sure the webapp module has the component modules in its
> classpath. Module class autoloading won't work, as there's no JAR for the
> component libraries included in this way, but then you can use the
> tapestry.modules VM argument to specify comma-separated fully qualified
> module class names to be loaded. Another option is to use @Submodule in
> your AppModule.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Ilya Obshadko

Re: [T5.4] split Tapestry application into separate modules

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 09 Jul 2014 17:38:04 -0300, Ilya Obshadko  
<il...@gmail.com> wrote:

> - component that was moved into separate module can't be loaded by main
> application using standard namespace; is there any way to fix that? (that
> is, <t:mycomponent/> results in UknownValueException);

That's expected: When you changed the component from the application to a  
component library, you've changed its namespace. You can advise or  
decorate ComponentClassResolver.resolveComponentTypeToClassName() and  
resolveMixinTypeToClassName() (for mixins), which are the methods which  
map logical names to component or mixin class names.

> - is that possible to run the whole thing within Eclipse without having  
> to install 'module' project into local repository?

Yes. Just make sure the webapp module has the component modules in its  
classpath. Module class autoloading won't work, as there's no JAR for the  
component libraries included in this way, but then you can use the  
tapestry.modules VM argument to specify comma-separated fully qualified  
module class names to be loaded. Another option is to use @Submodule in  
your AppModule.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.4] split Tapestry application into separate modules

Posted by Daniel Jue <te...@gmail.com>.
Yes, it could be an issue using an external maven.  I let Eclipse handle
the build while I'm developing, and I don't do a full external maven
rebuild unless I need to deploy war files.  Sometimes it helps to know the
art of the possible, and myself and my team have it working this way.  :-)
 Hopefully you find a development procedure that is right for you.




On Thu, Jul 10, 2014 at 6:04 AM, Ilya Obshadko <il...@gmail.com>
wrote:

> > For your last question, if you are using Eclipse Kepler or better, the
> > maven integration should be good enough to allow workspace resolution of
> > the other modules, as long as they are open.
> > i.e. you can change something in one module and have the dependent
> modules
> > pick up the changes, without needing to do a separate maven build or
> > install.  This even works between overlays and the main web app project.
> >
>
> I've been expecting it should work that way, but it doesn't.
>
> Unless I perform "mvn clean install" inside the module project, I receive
> build error
>
> "[WARNING] The POM for my.package:module-name:jar:0.0.1-SNAPSHOT is
> missing, no dependency information available"
>
> I suppose it has something to do with external Maven installation that I'm
> using instead of embedded one, but I'm not sure.
>
>
>
> > On Wed, Jul 9, 2014 at 4:38 PM, Ilya Obshadko <il...@gmail.com>
> > wrote:
> >
> > > I would like to modularize my application into several modules, so that
> > > each one of them would be a separate Maven artifact. I'm trying to
> > > reproduce what I can borrow from tapestry-upload module source, but
> still
> > > have questions:
> > >
> > > - component that was moved into separate module can't be loaded by main
> > > application using standard namespace; is there any way to fix that?
> (that
> > > is, <t:mycomponent/> results in UknownValueException);
> > > contributeComponentClassResolver() (like in tapestry-upload) doesn't
> help
> > > (or I just use it incorrectly)
> > >
> > > - is that possible to run the whole thing within Eclipse without having
> > to
> > > install 'module' project into local repository?
> > >
> > > Thanks in advance.
> > >
> > > --
> > > Ilya Obshadko
> > >
> >
>
>
>
> --
> Ilya Obshadko
>

Re: [T5.4] split Tapestry application into separate modules

Posted by Ilya Obshadko <il...@gmail.com>.
> For your last question, if you are using Eclipse Kepler or better, the
> maven integration should be good enough to allow workspace resolution of
> the other modules, as long as they are open.
> i.e. you can change something in one module and have the dependent modules
> pick up the changes, without needing to do a separate maven build or
> install.  This even works between overlays and the main web app project.
>

I've been expecting it should work that way, but it doesn't.

Unless I perform "mvn clean install" inside the module project, I receive
build error

"[WARNING] The POM for my.package:module-name:jar:0.0.1-SNAPSHOT is
missing, no dependency information available"

I suppose it has something to do with external Maven installation that I'm
using instead of embedded one, but I'm not sure.



> On Wed, Jul 9, 2014 at 4:38 PM, Ilya Obshadko <il...@gmail.com>
> wrote:
>
> > I would like to modularize my application into several modules, so that
> > each one of them would be a separate Maven artifact. I'm trying to
> > reproduce what I can borrow from tapestry-upload module source, but still
> > have questions:
> >
> > - component that was moved into separate module can't be loaded by main
> > application using standard namespace; is there any way to fix that? (that
> > is, <t:mycomponent/> results in UknownValueException);
> > contributeComponentClassResolver() (like in tapestry-upload) doesn't help
> > (or I just use it incorrectly)
> >
> > - is that possible to run the whole thing within Eclipse without having
> to
> > install 'module' project into local repository?
> >
> > Thanks in advance.
> >
> > --
> > Ilya Obshadko
> >
>



-- 
Ilya Obshadko

Re: [T5.4] split Tapestry application into separate modules

Posted by Daniel Jue <te...@gmail.com>.
Hi Ilya,
[caveat, I am using T 5.3.7]

Is each of your modules a fully functioning web app, or just partial?

You can specify the namespace of components in the project's module class

I am doing something similar to this with my project, Graphene
https://github.com/Sotera/graphene

The graphene-web module is not a stand-alone module, I use it as a war
overlay onto customer implementations.
It has it's own namespace.  There are several other maven modules, each
with one or more Tapestry module classes inside.  Right now I still use the
explicit submodule annotation for wiring, but I plan on allowing manifest
discovery of modules in the future.


For your last question, if you are using Eclipse Kepler or better, the
maven integration should be good enough to allow workspace resolution of
the other modules, as long as they are open.
i.e. you can change something in one module and have the dependent modules
pick up the changes, without needing to do a separate maven build or
install.  This even works between overlays and the main web app project.

Hope that helps.



On Wed, Jul 9, 2014 at 4:38 PM, Ilya Obshadko <il...@gmail.com>
wrote:

> I would like to modularize my application into several modules, so that
> each one of them would be a separate Maven artifact. I'm trying to
> reproduce what I can borrow from tapestry-upload module source, but still
> have questions:
>
> - component that was moved into separate module can't be loaded by main
> application using standard namespace; is there any way to fix that? (that
> is, <t:mycomponent/> results in UknownValueException);
> contributeComponentClassResolver() (like in tapestry-upload) doesn't help
> (or I just use it incorrectly)
>
> - is that possible to run the whole thing within Eclipse without having to
> install 'module' project into local repository?
>
> Thanks in advance.
>
> --
> Ilya Obshadko
>