On Tue, Jul 21, 2009 at 10:21 PM, David C. Hicks <[email protected]> wrote:
> One of the tenets of Maven is to create one artifact for each module. > Combining your source in the same directory tree violates that tenet. > I'm sure you can probably force Maven to do it, but it won't like it. > When you specify the <modules> you are essentially telling Maven to look > for pom.xml files in those sub-directories. Right... I moved the plugin code to its own subdirectory [1], but no difference (I agree it's cleaner though). It's possible that using "mvn compile" could be part of your problem. > When you only run the "compile" goal, you don't get to the "package" > goal, which is when the jar file would be created. I tried "package", and only "install" seems to have the correct effect of building the jar file. I suppose it's probably not going to hurt to install versus package... it just seems weird. After I do that, I get some "NoSuchElementException" from scala, but I'm guessing that's the scala maven plugin's fault. The jar appears to be correct. regards, Nicholas [1] http://github.com/gatoatigrado/skalch/commit/5163b21d82736045806adab40d2b607d59e9bfc5 > > > > Nicholas Tung wrote: > > 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 > > > > >
