2

I am using Maven with Nexus for building my project with hudson ci. Everytime when I am deploying a new snapshot artifact he is doing this with a unique version in nexus. Which is OK for me as Nexus is giving me always the latest version.

Now I looked into the war file of my project which is using this snapshot dependency and its having the following jar file in its lib directory which is absolutely not fine:

framework-client-1.1-20120302.141044-3.jar

The problem is that I am using EBean as an ORM and I need to specify the jar name in the ebean.properties to let him know where to find its models.

How can I prevent such behaviour so that the latest snapshot dep is always call framework-client-1.1-SNAPSHOT.jar?

Thank you!

Gambo
  • 1,572
  • 3
  • 26
  • 52
  • Which Maven version? How does your settings.xml look like? – khmarbaise Mar 06 '12 at 10:40
  • Maven 3.0.3 and JDK 6(24). My settings.xml is almost standard except the mirror settings for nexus – Gambo Mar 06 '12 at 10:51
  • Have you configured to use uniqueVersion in the mirror settings for the nexus repository ? – khmarbaise Mar 06 '12 at 11:31
  • No and it has no effect as well: https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html – Gambo Mar 06 '12 at 12:33
  • Have you configured the uniqueVersion in your distributionManagement block ? (http://maven.apache.org/pom.html#Repository) – khmarbaise Mar 06 '12 at 12:49
  • Have you tried using the finalName property? – Michael Mar 06 '12 at 17:34
  • Maven probably does have a config setting to change this behaviour but if not, maybe also try looking into the EBean settings/config, does it have any options for specifying a JAR name or can it use wildcards or anything like that? – Jesse Webb Mar 30 '12 at 17:59

1 Answers1

0

Just rename the jar in the war file to whatever name you like. Details are here

Renaming Maven dependency in WAR's WEB-INF/lib folder

Community
  • 1
  • 1
Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
  • 1
    I would only agree with this option if there is no config to fix the root problem. This seems like just a hack/work-around which doesn't fix the real issue. – Jesse Webb Mar 30 '12 at 17:57
  • Well... this is the fix if you need it to work in development. If you use a non-snapshot version you will not need it. So if you like you can just have this in a dev profile and just leave it out for the release profile.. you will have to accept that snapshots get deployed as time stamp named artifacts.. thats how it is. – Manfred Moser Mar 30 '12 at 18:07
  • I am fairly certain that you can configure maven to not uniquely identify snapshots because I remember needing to do it a couple years ago in maven 2. If not though, you are right, renaming the JAR put into the WAR is an appropriate solution. – Jesse Webb Mar 30 '12 at 18:10
  • On deployment to a repo server it will always get the timestamp if it is a snapshot... no choice about that, if you try to circumvent that you will break the notion of a SNAPSHOT which will cause you a lot more pain.. dont fight maven, it always ends in tears or wasted effort ;-) – Manfred Moser Mar 30 '12 at 18:15