You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by wimcolgate <wi...@gmail.com> on 2012/01/31 22:39:27 UTC

Noob question

Sorry for the remedial question. Noob here.

I am working in a java project that can be built using IntelliJ, Eclipse and
Ant; I want to add maven as an alternative.

I've modified pom.xml to override the defaults, and correctly locate the
sources for the main-line and tests. The directory structure is thus, not in
the default src/ test/ ... format. I can build the main src.

However, the original project also has a set of examples, as well as a
source utility (under a different package name) that is required by both the
test's and example's.

Is there a way to tweak my pom.xml to also build the examples, and reference
the utility source?

Thanks,

Wim

--
View this message in context: http://maven.40175.n5.nabble.com/Noob-question-tp5445807p5445807.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Noob question

Posted by Barrie Treloar <ba...@gmail.com>.
On Wed, Feb 1, 2012 at 10:15 AM, wimcolgate <wi...@gmail.com> wrote:
> I re-arranged things, the way I probably should have started.

The best advice I have seen is
"Don't fight against Maven, you'll loose. So, follow and use its
conventions, adopt its philosophy, use it the way it works. If Maven
doesn't work the way YOU want, don't use it.
http://stackoverflow.com/a/2254528/552958
(repeated on this list many time by others as well)

There is a reason that Maven has convention over configuration.
And as you have noticed, it's easier to conform to Maven and backport Ant :)

> The examples is now the main maven pom.xml. I indicate in my pom.xml, that
> have two modules, the utility class and the rest of the main library. These
> now all build into .class files.
>
> Next hurdle is to figure out how to build the examples. There are at least
> 11, and more will be forthcoming.
>
> The research I've done indicates maven's design center is a one jar/war per
> project; however, I did find this:
>
> http://stackoverflow.com/questions/2132958/ant-to-maven-multiple-build-targets
>
> Is this the proper path to follow?

It's not quite the same thing, but it is sound advice.

Chances are your configuration files and resources are going to be
identical amongst the examples, but as soon as they differ you will
have wished you split them into their own modules.
I'd recommend inserting another level into your build module named
"examples" so that your example projects are kept out of the way of
the main project and are easy to find.
i.e.
root/
  utilities/
  library/
  examples/
    example-1/
    example-2/
    ...
    example-n/

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


Re: Noob question

Posted by wimcolgate <wi...@gmail.com>.
I re-arranged things, the way I probably should have started.

The examples is now the main maven pom.xml. I indicate in my pom.xml, that
have two modules, the utility class and the rest of the main library. These
now all build into .class files.

Next hurdle is to figure out how to build the examples. There are at least
11, and more will be forthcoming.

The research I've done indicates maven's design center is a one jar/war per
project; however, I did find this:

http://stackoverflow.com/questions/2132958/ant-to-maven-multiple-build-targets

Is this the proper path to follow?

Thanks,

Wim

--
View this message in context: http://maven.40175.n5.nabble.com/Noob-question-tp5445807p5446069.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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