You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Marc Fargas <te...@telenieko.com> on 2018/07/23 07:44:14 UTC

DataNucleus enhancer on multimodule projects

Hi,

I just recently discovered Apache Isis and aI'm now pissed at Google Search
for not find it earlier for me (it's exactly what I needed, but incredibly
hard to come by!).

Documentation recommends that, after some playing around with the Hello
World, you go with the archetype that comes with a multimodule app. Which
is awesome as you get a nice long term structure from the start.

My problem is with the enhancer though. Following the steps to make
IntelliJ work I shall call
"mvn datanucleusenhancer  -o" and there are screenshots etc but... This is
not for multimodule projects.

Of course, Option A) would be to add the task for every module I have on
the Run Configuration.
But, and the reason I write you, Is there an Option B) by which I can call
datanucleusenhancer on all modules without manually listing them?

Thanks,
marc

PS: Sorry in advance if this message ir badly formatted. It's been quite a
while since I last used a mailling list! :)

Re: DataNucleus enhancer on multimodule projects

Posted by Marc Fargas <te...@telenieko.com>.
Hi,

On Tue, Jul 24, 2018 at 12:55 AM Dan Haywood
<da...@haywood-associates.co.uk> wrote:
> [1] and [2] look correct to me, though - the ":" is there.  Perhaps a bit tricky to see depending on resolution?

Yeah, I have a valid excuse for a new Retina display!

> An alternative approach is to define a profile in the parent module, eg:
>
> <profiles>
>   <profile>
>     <id>enhance</id>
>     <activation>
>       <property>
>          <name>enhance</name>
>       </property>
>     </activation>
>     <modules>
>       <module>module-customer</module>
>       <module>module-order</module>
>     </modules>
>   </profile>
> </profiles>
>
> Then you could use:
>
> mvn -Denhance datanucleus:enhance -o

This is exactly what I was looking for.

Thank you very much,
Marc

Re: DataNucleus enhancer on multimodule projects

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Glad you sorted it out, Marc.

[1] and [2] look correct to me, though - the ":" is there.  Perhaps a bit
tricky to see depending on resolution?

To answer your question more generally - and as you've probably gathered -
it's only necessary to run "datanucleus:enhance" in the modules where there
are entities.  In the archetypes there is just one module - for
"helloworld" it's a one-module project anyway, while for "simpleapp" it's
the "module-simple" module.

If you choose to split out your entities across multiple Maven modules then
you will need to run "datanucleus:enhance" in all of them.  Suppose you've
got modules in "module-customer" and "module-order"; then you could run the
following in the parent module:

mvn -pl module-customer,module-order datanucleus:enhance -o

Here "-pl" flag takes a comma-separated list of modules to run the enhance
goal in.

An alternative approach is to define a profile in the parent module, eg:

<profiles>
  <profile>
    <id>enhance</id>
    <activation>
      <property>
         <name>enhance</name>
      </property>
    </activation>
    <modules>
      <module>module-customer</module>
      <module>module-order</module>
    </modules>
  </profile>
</profiles>

Then you could use:

mvn -Denhance datanucleus:enhance -o

with the profile activated by the presence of the system property.

HTH
Dan


On Mon, 23 Jul 2018 at 09:50 Marc Fargas <te...@telenieko.com> wrote:

> On Mon, Jul 23, 2018 at 10:38 AM Marc Fargas <te...@telenieko.com>
> wrote:
> > On Mon, Jul 23, 2018 at 9:52 AM Martin Grigorov <mg...@apache.org>
> wrote:
> > > On Mon, Jul 23, 2018 at 10:44 AM Marc Fargas <te...@telenieko.com>
> > > > My problem is with the enhancer though. Following the steps to make
> > > > IntelliJ work I shall call
> > > > "mvn datanucleusenhancer  -o" and there are screenshots etc but...
> This is
> > > > not for multimodule projects.
> > > >
> > > > Of course, Option A) would be to add the task for every module I
> have on
> > > > the Run Configuration.
> > > > But, and the reason I write you, Is there an Option B) by which I
> can call
> > > > datanucleusenhancer on all modules without manually listing them?
> > > >
> > > You need to enhance only the 'dom' module, the one that contains your
> > > domain objects.
>
> I just found out I can do
>     mvn  datanucleus:enhance -o
> From the root folder of my project.
>
> Please note that the IntelliJ instructions, on the screenshot of the
> run configutations, says "datanucleusenhance" (without the ":" in the
> middle) [1] and [2]. It is properly shown in [3]
>
> [1]:
> https://isis.apache.org/guides/dg/dg.html#__dg_ide_intellij_running_the-app
> [2]:
> https://isis.apache.org/guides/dg/images/intellij-idea/110-running-the-app/010-run-configuration.png
> [3]:
> https://isis.apache.org/guides/dg/dg.html#_dg_hints-and-tips_enhance-only
>
> Thanks for the help,
> Marc
>
-- 
DISCLAIMER: This e-mail is from Haywood Associates Ltd (Registered Number
3525455) and it and its attachments may be confidential and are intended
solely for the use of the individual to whom it is addressed.  Any
unauthorised use or dissemination of this communication is strictly
prohibited. Any information provided to Haywood Associates Ltd shall be
retained and used in accordance with our Privacy Statement at
http://www.haywood-associates.co.uk/privacy.  If you have received this
communication in error, please immediately notify the sender by return
e-mail message and delete all copies of the original communication.

Re: DataNucleus enhancer on multimodule projects

Posted by Marc Fargas <te...@telenieko.com>.
On Mon, Jul 23, 2018 at 10:38 AM Marc Fargas <te...@telenieko.com> wrote:
> On Mon, Jul 23, 2018 at 9:52 AM Martin Grigorov <mg...@apache.org> wrote:
> > On Mon, Jul 23, 2018 at 10:44 AM Marc Fargas <te...@telenieko.com>
> > > My problem is with the enhancer though. Following the steps to make
> > > IntelliJ work I shall call
> > > "mvn datanucleusenhancer  -o" and there are screenshots etc but... This is
> > > not for multimodule projects.
> > >
> > > Of course, Option A) would be to add the task for every module I have on
> > > the Run Configuration.
> > > But, and the reason I write you, Is there an Option B) by which I can call
> > > datanucleusenhancer on all modules without manually listing them?
> > >
> > You need to enhance only the 'dom' module, the one that contains your
> > domain objects.

I just found out I can do
    mvn  datanucleus:enhance -o
From the root folder of my project.

Please note that the IntelliJ instructions, on the screenshot of the
run configutations, says "datanucleusenhance" (without the ":" in the
middle) [1] and [2]. It is properly shown in [3]

[1]: https://isis.apache.org/guides/dg/dg.html#__dg_ide_intellij_running_the-app
[2]: https://isis.apache.org/guides/dg/images/intellij-idea/110-running-the-app/010-run-configuration.png
[3]: https://isis.apache.org/guides/dg/dg.html#_dg_hints-and-tips_enhance-only

Thanks for the help,
Marc

Re: DataNucleus enhancer on multimodule projects

Posted by Marc Fargas <te...@telenieko.com>.
Hi,

On Mon, Jul 23, 2018 at 9:52 AM Martin Grigorov <mg...@apache.org> wrote:
> On Mon, Jul 23, 2018 at 10:44 AM Marc Fargas <te...@telenieko.com>
> > Documentation recommends that, after some playing around with the Hello
> > World, you go with the archetype that comes with a multimodule app. Which
> > is awesome as you get a nice long term structure from the start.
> >
> > My problem is with the enhancer though. Following the steps to make
> > IntelliJ work I shall call
> > "mvn datanucleusenhancer  -o" and there are screenshots etc but... This is
> > not for multimodule projects.
> >
> > Of course, Option A) would be to add the task for every module I have on
> > the Run Configuration.
> > But, and the reason I write you, Is there an Option B) by which I can call
> > datanucleusenhancer on all modules without manually listing them?
> >
> You need to enhance only the 'dom' module, the one that contains your
> domain objects.

Yup, but as far as I understand, I shall have a 'dom' module inside
every application module. For example, estatio has "agreement",
"party" and "asset" modules all of which have a "dom" part.

(Note that estatio has different modules but not different Maven modules)

The recommended setup (and the one created by the archetype) is to
have different maven modules, initially: appdefn, module-base,
module-simple, webapp.

So, at the very beggining only module-simple needs enhancement. But
suppose I now clone module-simple to create my own "party" and
"agreement" modules.

At that point I'd need to enhance the three modules so I'd need to
modify my run configurations to do so (Option A) or, magically, tell
maven "run datanucleusenhance on all the submodules that have such
target"

> > Of course, Option A) would be to add the task for every module I have on
> > the Run Configuration.
> > But, and the reason I write you, Is there an Option B) by which I can call
> > datanucleusenhancer on all modules without manually listing them?

It is also possible I did not properly understand the recommended
setup and I'm on a totally wrong path!

Thanks,
Marc

Re: DataNucleus enhancer on multimodule projects

Posted by Martin Grigorov <mg...@apache.org>.
Hi Marc,

Welcome to Apache Isis!

You need to enhance only the 'dom' module, the one that contains your
domain objects.
There is no need to enhance the webapp stuff or the integration tests. I
think it won't break anything if you try to enhance them but it will slow
down your build.

On Mon, Jul 23, 2018 at 10:44 AM Marc Fargas <te...@telenieko.com>
wrote:

> Hi,
>
> I just recently discovered Apache Isis and aI'm now pissed at Google Search
> for not find it earlier for me (it's exactly what I needed, but incredibly
> hard to come by!).
>
> Documentation recommends that, after some playing around with the Hello
> World, you go with the archetype that comes with a multimodule app. Which
> is awesome as you get a nice long term structure from the start.
>
> My problem is with the enhancer though. Following the steps to make
> IntelliJ work I shall call
> "mvn datanucleusenhancer  -o" and there are screenshots etc but... This is
> not for multimodule projects.
>
> Of course, Option A) would be to add the task for every module I have on
> the Run Configuration.
> But, and the reason I write you, Is there an Option B) by which I can call
> datanucleusenhancer on all modules without manually listing them?
>
> Thanks,
> marc
>
> PS: Sorry in advance if this message ir badly formatted. It's been quite a
> while since I last used a mailling list! :)
>