I am having an issue setting jar versions in Maven and trying to resolve this
through Best Practices

What I have is my project pom.xml that will build project MyJar. In the Pom,
I have dependencies setup like this

    <dependency>
      <groupId>org.apache</groupId>
      <artifactId>xalan</artifactId>
      <version>${xalanVersion}</version>
    </dependency>

In my settings.xml, I control the version that is current, for example

<xalanVersion>2.4.1</xalanVersion>

This works great. I build MyJar, it resolves the version of xalan required
to build it and it installed MyJar.jar and MyJar.pom into the repository

Now, here is where the problem comes up.

I try to build MyJar2. It is dependent upon MyJar to compile. So I have this
dependency listed in my pom.xml for MyJar2

    <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>MyJar</artifactId>
      <version>${MyJarVersion}</version>
    </dependency>

And in settings.xml, I have

<MyJarVersion>1/0</MyJarVersion>

Now, when I try to compile MyJar2, it sees that I need MyJar so it tries to
download the pom for MyJar from the repository however for some reason, when
it sees the pom for MyJar, it becomes confused on what settings.xml to use.
It cannot resolve dependencies anymore. If I go into the repository and
delete the pom in the MyJar folder then try to compile it works just fine.

 I do have the settings.xml in /home/user/.m2 linked to the the
/usr/local/maven-2.0.7/conf folder where the default settings.xml lives


So, I think I am doing it wrong. How do others handle this? I have tried
creating a parent pom with the version in it and then referencing the parent
pom in the child pom but that does not seem to work either. I know I am
missing something but sometimes, you overlook the easist things and you need
another set of eyes to look at it and say ah, this is why.

I suppose I could just have the build script delete the pom from the
repository after it loads the jar but I know that is a hack and not the
right way to do it. 

Any help or  suggestions would be much appreciated.

Regards,
Mark
-- 
View this message in context: 
http://www.nabble.com/How-to-properly-set-jar-versions-for-builds-tf4733418s177.html#a13535119
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to