On Sat, 5 Nov 2005, Oscar Picasso wrote:

> Hi,
>
> I have happily used maven 1.0 and trying to switch to M2 mainly because I want
> to work with modules. But I have some difficulties to understand how it is
> supposed to work.
>
> I have tried the following:
>
> mvn archetype:create -DgroupId=org.trial -DartifactId=test
> cd test
> mvn jar:jar
>
> and I get
> ...
> [WARNING] JAR will be empty - no content was marked for inclusion!
> ...
> and the jar effectively does not contain the class files.
>
>
> But if I do:
> mvn compiler:compile jar:jar
>
> The jar contains the expected class files.
>
> Isn't supposed the jar:jar execute the precious phases (that is compile) 
> before
> making the jar?
>

No - goals like X:Y are just single plugin goals.

maven2 has the notion of a 'lifecyle'. You want to call 'mvn install',
which will call ALL plugin goals to compile, test and package that
project.

> Furthermore in any case the resulting jar contains the following:
> META-INF/
> META-INF/MANIFEST.MF
> ...
> META-INF/maven/
> META-INF/maven/org.trial/
> META-INF/maven/org.trial/test/
> META-INF/maven/org.trial/test/pom.xml
> META-INF/maven/org.trial/test/pom.properties
>
> What is the purpose of these pom.xml and pom.properties in the resulting jar?
> They contain information about my working directory which is of no use for a
> released jar and I even don't see where they come from. They seem to be
> magically generated by maven.

Correct. They are used to track where a pom came from. The pom.xml is the
original pom, so you could extract it if you just found a single jar
somewhere, and see what it is. The pom.properties contains information
like the time the project was built.

>
> Another mystery:
> If I do
>
> mvn deploy:deploy
>
> I get:
> ...
> [ERROR] BUILD ERROR
> [INFO]
> ----------------------------------------------------------------------------
> [INFO] The packaging for this project did not assign a file to the build
> artifact
> ...
>
> but it if I do:
> mvn compiler:compile jar:jar deploy:deploy
>
> It works fine (excepted for the added META-INF mentioned above).

Deploy:deploy should be called from within a lifecycle, like you do below:

> Also:
> m2 deploy
> works fine too. However I get the message: THE m2 COMMMAND IS DEPRECATED -
> PLEASE RUN mvn INSTEAD

Yup.

> but if I use
> m2 jar:jar
> I get the same result than with `mvn jar:jar` (compile phase is skipped).

m2 is an old shell script/batchfile that calls mvn underwater.
>
> Did I miss something?

Yes, you missed reading http://maven.apache.org/maven2/ ;) Maven2 is
totally different from maven1. I suggest you read up on the new
stuff there.

> If I remember, maven 1.0 was more consistent and worked fine out of the box.
>

Maven2 is more consistent than maven1, but you're applying maven1
practises (jar:jar etc) to maven2, which doesn't work as you expect it to
work - because maven2 is not maven1! :)

Anyway, thanks for making the switch. Once you're a bit more familiar with
how to work with maven2, I'm sure you'll see it's easier to use than
maven1!


-- Kenney

> Thanks.
>
>
> Oscar
>
>
>
> __________________________________
> Yahoo! FareChase: Search multiple travel sites in one click.
> http://farechase.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to