aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes how to make the plugin jar to take the specified version from the pom. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "how to make the plugin jar to take the specified version from the pom." Watch "how to make the plugin jar to take the specified version from the pom." New topic
Author

how to make the plugin jar to take the specified version from the pom.

Sam Deshalwa
Greenhorn

Joined: Jan 05, 2009
Posts: 7
The <parent><version> is being inherited in project version.When i run mvn install then it pick up parent version (1.2.1)for creating jar in target folder and in local repo it is creating jar with project version(1.2.2).
But i want to crate both with same version(1.2.2).Its lettle bit confusing because both have different version.

<parent>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-parent</artifactId>
<version>1.2.1</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>axis2-maven-plugin</artifactId>
<version>1.2.2</version>
Thapliyal Akshat
Greenhorn

Joined: Jun 04, 2009
Posts: 29
Hi Sanjay,

I tried to replicate your problem but unfortunately It build with the version that I have specified for the specific module in both places (repot and target). That is, It did not picked my parent pom version.

I would suggest you to run this command mvn help:effective-pom.

It would display you the exact pom that is being run by maven. So execute it and check if you find any thing there.

I will be giving more try to your problem.

Thanks and Regards,
Akshat
Sam Deshalwa
Greenhorn

Joined: Jan 05, 2009
Posts: 7
Thanks for write-up.

I still facing same problem..
Run this commond and i got error

mvn help:effective-pom


[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-help-plugin' does not exist or
no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Oct 01 05:21:40 MDT 2009
[INFO] Final Memory: 1M/2M
[INFO] ------------------------------------------------------------------------


Is it possible to share your pom file which were you created for replicate this problem.

Again thanks.
Thapliyal Akshat
Greenhorn

Joined: Jun 04, 2009
Posts: 29
Ok,

So your maven help plugin is not working..

My dummy project hierarchy is as follows:

|---secondDemo (contains parent pom.xml)
|
|------------------jaxb-api (contains module1 pom.xml)
|------------------------------src
|-------------------------------------main
|--------------------------------------------xsd (contains simple xsd file)
|------------------jaxb-src (contains module2 pom.xml)
|------------------------------src
|-------------------------------------main
|--------------------------------------------java
|-------------------------------------------------com
|------------------------------------------------------akki
|-----------------------------------------------------------mvn (Contains my simple hello world class)


PARENT POM.XML




MODULE1 (jaxb-api) POM.XML


MODULE2 (jaxb-src) POM.XML




Just create a structure the way I have created and copy the pom.xml in the respective directories.
Then on the module 1 folder execute the command mvn install. This will deploy your jaxb-api-1.1.jar in your local repo.

Once done. Goto your parent directory and execute the command on the parent pom.
mvn package.

Thanks and Regards
Akshat

Sam Deshalwa
Greenhorn

Joined: Jan 05, 2009
Posts: 7
Thanks Akshat.

I am going to follow same directory structure which you explained above but I compare my child pom with your child pom and i came out with question.

How to child pom get the reference of parent pom because you havn't mentioned parent reference in child pom?
Please find below difference between your and my pom. (<relativePath>)


It's your child pom

# <modelVersion>4.0.0</modelVersion>
# <parent>
# <artifactId>secondDemo</artifactId>
# <groupId>com.akki.mvn</groupId>
# <version>1.0</version>
# </parent>
#
# <groupId>com.akki.mvn</groupId>
# <artifactId>jaxb-api</artifactId>
# <version>1.1</version>
# <name>jaxb-api</name>
# <url>http://maven.apache.org</url>

It's my child pom

<parent>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-parent</artifactId>
<version>1.2.1</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>axis2-maven-plugin</artifactId>
<version>1.2.2</version>


Thanks

Thapliyal Akshat
Greenhorn

Joined: Jun 04, 2009
Posts: 29
Hi Sanjay,

In the first post only I have noticed your <relativePath>../../parent/pom.xml</relativePath>. But I thought you have done this intentionally.

First thing I want to convey is: Maven works on inheritance.
You define your parent pom.xml and then you define dependencies/Sub modules under <modules>.
Now your parent pom packaging should be of type pom in order to make it parent. Parent now know who are his child.

But how would a child/module will define a relationship with parent.
In each module you define

This is what how a child is related to its parent.

Just FYI this is known as cyclic dependency in Maven. Parent <-> child.

If you want to learn more abt maven how does it creates and maintain the structure I would suggest you to read something related to managing multi-module project in maven. Its only 30 minutes guide.

http://scriptlandia.blogspot.com/2006/05/how-to-make-javaee-project-with-maven2.html

Just spend some time on above url. Its a practical guide. Do what the author says and you will know lot of things about Maven which you don't do often.

Thanks and Regards,
Akshat.

 
wood burning stoves
 
subject: how to make the plugin jar to take the specified version from the pom.