On Tue, Jul 21, 2009 at 9:47 PM, David C. Hicks <[email protected]> wrote:

> It's hard to say from your description, but it sounds like you need to
> do some serious restructuring of your project.  Here's what I think you
> need to have:
>
> base-of-project/
>    pom.xml
>
>    myproj-plugin/
>        pom.xml
>        src/main/scala code goes here
>
>    myproj-base/
>        pom.xml
>        src/main/other code goes here


This unnecessarily separates java code in myproj-base from myproj-plugin,
but sure.


> The pom.xml in the base directory would have your <modules> section and
> look like this:
>
>    <modules>
>        <module>myproj-plugin</module>
>        <module>myproj-base</module>
>    </modules>


I'm using this exactly [1]


> This is where the pom.xml files in each sub-directory come into play.
> The pom.xml in myproj-base would list "myproj-plugin" as a dependency.
> You assign the groupId, artifactId, and version to myproj-plugin in the
> top of its pom.xml.  Then you can reference that artifact just like you
> would any other artifact.  The difference is that Maven knows to find it
> inside the reactor during the build.


I'm already doing this as well [2]; thanks anyway though.

It is far better to bend your expectations to the way that Maven wants
> to work than to try to force it into submitting to the way YOU want to
> do things.  Just learn new habits and you will be far happier letting
> Maven do all the neat things it does for you for free.


I'm very willing to restructure the project (i.e. move actual locations of
source files around). However, I don't see any advantage if Maven won't do
things differently. Will it actually build the jar for one project when I
type mvn compile? I am specifying one project as the dependency of another
using the standard group-artifact-version tags [3].

Maven is already correctly building (mvn compile) myproj-plugin before
myproj-base. However, it isn't packaging it as a jar for the Maven Scala
plugin.

Thanks so much,
Nicholas

[1]
http://github.com/gatoatigrado/skalch/blob/9e1d2d0fd05c3fd9c7fbbfadfbe44b1bfa31b388/pom.xml#L43
[2]
http://github.com/gatoatigrado/skalch/blob/9e1d2d0fd05c3fd9c7fbbfadfbe44b1bfa31b388/skalch-base/pom.xml#L52
[3]
http://github.com/gatoatigrado/skalch/blob/9e1d2d0fd05c3fd9c7fbbfadfbe44b1bfa31b388/skalch-base/pom.xml#L34

Reply via email to