You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Oscar Picasso <os...@yahoo.com> on 2005/11/05 18:07:15 UTC

Strange M2 behavior

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?


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.

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).

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

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

Did I miss something? 

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


Thanks.


Oscar


		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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


Re: Strange M2 behavior

Posted by Brett Porter <br...@gmail.com>.
They are only inside JARs built with m2.

- Brett

On 11/6/05, Oscar Picasso <os...@yahoo.com> wrote:
> -- Kenney Westerhof <ke...@apache.org> wrote:
>
> > On Sat, 5 Nov 2005, Oscar Picasso wrote:
> ...
> > > 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.
>
> Just curious. I have looked at some jar in the maven2 ibiblio repository and
> did n't find these pom.xml and pom.properties. Does it mean that the jars where
> filtered or that the jars where generated with maven2 ?
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Strange M2 behavior

Posted by Oscar Picasso <os...@yahoo.com>.
-- Kenney Westerhof <ke...@apache.org> wrote:

> On Sat, 5 Nov 2005, Oscar Picasso wrote:
...
> > 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.

Just curious. I have looked at some jar in the maven2 ibiblio repository and
did n't find these pom.xml and pom.properties. Does it mean that the jars where
filtered or that the jars where generated with maven2 ?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Strange M2 behavior

Posted by Oscar Picasso <os...@yahoo.com>.
Hi,

Thanks for your input. It helped a lot.

I overlooked the "Getting started guide..." maybe after reading "This guide is
intended as a reference for those working with Maven for the first time..." I
jumped directly to the Documentation section.

Too many docs to read these days, and not enough hours in a day. So I missed
the obvious.

Oscar

--- Kenney Westerhof <ke...@apache.org> wrote:

> 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> 
> --
> Kenney Westerhof
> http://www.neonics.com
> GPG public key: http://www.gods.nl/~forge/kenneyw.key
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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


Re: Strange M2 behavior

Posted by Kenney Westerhof <ke...@apache.org>.
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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

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

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


Re: Strange M2 behavior

Posted by Jason van Zyl <ja...@maven.org>.
On Sat, 2005-11-05 at 09:07 -0800, 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

Already here at this point I can see you haven't read any of the m2
documentation. Please start with the getting starting guide and you will
have better luck:

http://maven.apache.org/guides/getting-started/index.html

-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

Three people can keep a secret provided two of them are dead.

 -- Unknown


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