Ask Your Question
0

How do I target a particular ODL release when using Maven archetypes?

asked 2015-07-09 14:04:46 -0700

arthurc gravatar image

Just started looking at ODL. When creating a plugin using the Maven archetypes, it's not clear how a particular ODL release is targeted. I was following a "hello world" example and have since expanded it with other YANG RPCs. I seem to have gotten into dependency hell trying to sort what SNAPSHOT versions go with what releases and there's little in the way of clear guidance. Perhaps I'm missing something obvious here (n00b and all).

In the examples where code is generated from the archetype, there doesn't appear to be anything that references an ODL version. My only guess is it's getting the latest-greatest. I thought perhaps the ~/.m2/settings.xml file was the clue but again, nothing evident there that targets Helium versus Lithium for instance.

Any clarification would be appreciated.

/a

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-07-10 05:02:58 -0700

Vishal Thapar gravatar image

You can specify version of archetype to use when generating archetype. So, do the following:

  1. Take a look at this link and go to folder of the archetype you're using. Let us say you're using startup-project archetype.

  2. Open pom.xml and set the branch to whichever you want. Let us say, stable/lithium.

  3. Check the version field in pom. For our example this turns out to be 1.1.0-SNAPSHOT
  4. Now, add -DarchetypeVersion= to the command line you use to mvn generate:archetype. In our case, it would be -DarchetypeVersion=1.1.0-SNAPSHOT. If you're following Startup Archetype Wiki, whole command would be something like mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype \ -DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ \ -DarchetypeCatalog=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml -DarchetypeVersion=1.1.0-SNAPSHOT

In theory this should work. I can't confirm as I don't have access to my dev setup right now. Try it out and let us know how it goes.

edit flag offensive delete publish link more

Comments

Thanks. Back to something functional. Still having dependency problems but for a different reason. Seems most of the time I'm fighting with the build environment instead of adding useful code. The battle continues.

arthurc ( 2015-07-10 09:45:13 -0700 )edit

I know the pain (: Think of it as learning curve. Can you confirm that this used right versions in all generated pom files?

Vishal Thapar ( 2015-07-10 22:38:42 -0700 )edit

The archetype above doesn't appear to have existed in Helium. I tried odl-model-project with different versions and the sole pom.xml file did have a different version. When I have a chance, I'll try to find an archetype common to helium and lithium with more than one pom.xml.

arthurc ( 2015-07-13 07:10:06 -0700 )edit

Oh yeah, startup project was introduced early lithium, I think. Other archetypes should be available in Helium.

Vishal Thapar ( 2015-07-14 00:23:33 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
3 followers

Stats

Asked: 2015-07-09 14:04:46 -0700

Seen: 720 times

Last updated: Jul 10 '15