You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by matthewadams <ma...@yahoo.com> on 2007/01/03 23:23:38 UTC

Compile failing when using version range & build number

Hi all,

I'm using Maven 2.0.4 and three things that I can't seem to put together
correctly:  build numbers in the published remote repository, a remote
repository and version range in client project dependencies' pom.xml files.

Our company uses major.minor.revision version numbers along with build
numbers, such that any given release of our product is known as something
like "4.2.1 build 1228", "4.3.1 build 1231" or "4.3.1 build 1250".  I read
about the version string syntax "major.minor.revision[(-qualifier |
-build)]", so I set up our remote repository's maven-metadata.xml to be:

<metadata>
  <groupId>mygroup</groupId>
  <artifactId>myartifact</artifactId>
  <version>4.3.1-1250</version>
  <versioning>
    <versions>
      <version>4.3.1-1231</version>
      <version>4.3.1-1250</version>
    </versions>
  </versioning>
</metadata>

(I'm not sure how Maven knows that the "-1231" & "-1250" are build numbers
and not qualifiers.  It looks like magic to me.)

Anyway, I would like to make it so that Maven2-based projects that depend on
our software simply have to state that they depend on a given version or
later; ideally, they wouldn't even have to know the build number.  I am
using a version range in my project's pom:

        ...
        <dependency>
            <groupId>mygroup</groupId>
            <artifactId>myartifact</artifactId>
            <version>[4.3.1,)</version>
        </dependency>
        ...

I'm setting up the remote repository in the pom, too (not in settings.xml,
as this project is a demo that is being redistributed so people can build
and run it without having to modify their local settings.xml):

    ...
    <repositories>
        <repository>
            <id>myrepo</id>
            <name>My Repository</name>
            <url>http://blahblahblah.com/maven</url>
        </repository>
    </repositories>
    ...

Upon building ("mvn install"), Maven downloads the latest build correctly
from the remote repository automatically as it should, but when compiling,
Maven issues the message

[INFO] [compiler:compile]
Compiling 6 source files to
...
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

No versions are present in the repository for the artifact with a range
[4.3.1,)
  mygroup:myartifact:jar:null

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  snapshots (http://snapshots.maven.codehaus.org/maven2)

I noticed that myrepo is not listed among these repositories.  Could that be
an indicator of the problem?  Why is maven correctly identifying and
downloading the artifact to my local repository, yet failing to resolve the
artifact at compile time?  I have completely deleted my remote repository
before trying this, and I have tried specifying version strings of
"[4.3.1-1231,)" and "[4.3.1-1250,)", all to no avail.  All I get is the
above error.

Why isn't this working?  How do I fix it?

Thanks,
Matthew
-- 
View this message in context: http://www.nabble.com/Compile-failing-when-using-version-range---build-number-tf2916373s177.html#a8149972
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