You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by sebersole <st...@hibernate.org> on 2015/05/28 21:11:39 UTC

Re: Add additional local maven repository - how?

I am having trouble with this via Pax Exam.  

I have an artifact that is currently not available in Maven Central.  So I
specify the appropriate repository in Pax Exam @Configuration method, using:

    return options(
            repositories(
                    repository(
"http://repository.jboss.org/nexus/content/groups/public/" )...
            )
    );

However, I keep getting errors that the artifact cannot be resolved:

shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Could not
find artifact org.jboss.logging:jboss-logging:jar:3.3.0.Final in central
(http://repo1.maven.org/maven2/)

Is this just a bad error message?  Or is Karaf really only looking in Maven
Central even though I (thought I) told it to look in JBoss Nexus as well?

As you can see, the artifact is there...

https://repository.jboss.org/nexus/content/groups/public/org/jboss/logging/jboss-logging/3.3.0.Final/



--
View this message in context: http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040638.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Add additional local maven repository - how?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Could you move the editConfiguration... part right before the
configureConsole() part.
I think at that point it's not working.

Take the baseTest Class from the Pax-Web project as a sample.
This part is configured in a later step. [1]

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf/KarafBaseTest.java#L95


2015-05-28 23:08 GMT+02:00 sebersole <st...@hibernate.org>:

> Achim,
>
> That file was seemingly not touched.  The file has no mention of "modified
> by paxexam" and the setting has no mention of my repo:
>
> org.ops4j.pax.url.mvn.repositories= \
>     http://repo1.maven.org/maven2@id=central, \
>
>
> http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release
> ,
> \
>
>
> http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external
> ,
> \
>     http://zodiac.springsource.com/maven/bundles/release@id=gemini, \
>
>
> http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases
> ,
> \
>
>
> https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases
> ,
> \
>
>
> https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases
>
> Here is my @Configuration method:
>
>                 return options(
>                                 when( debug ).useOptions(
> debugConfiguration( "5005", true ) ),
>                                 karafDistributionConfiguration()
>                                                 .frameworkUrl(
> paxExamEnvironment.getProperty(
> "org.ops4j.pax.exam.container.karaf.distroUrl" ) )
>                                                 .karafVersion(
> paxExamEnvironment.getProperty(
> "org.ops4j.pax.exam.container.karaf.version" ) )
>                                                 .name( "Apache Karaf" )
>                                                 .unpackDirectory(
>                                                                 new File(
>
>       paxExamEnvironment.getProperty(
>
>                       "org.ops4j.pax.exam.container.karaf.unpackDir"
>
>       )
>                                                                 )
>                                                 )
>                                                 .useDeployFolder( false ),
>                                 editConfigurationFileExtend(
>
> "org.ops4j.pax.url.mvn.cfg",
>
> "org.ops4j.pax.url.mvn.repositories",
>                                                 "
> https://repository.jboss.org/nexus/content/groups/public/"
>                                 ),
>
> configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
> //                              when( debug ).useOptions(
> keepRuntimeFolder() ),
>                                 keepRuntimeFolder(),
>                                 logLevel( LogLevelOption.LogLevel.INFO ),
>                                 features( featureXmlUrl(
> paxExamEnvironment ), "hibernate-native",
> "hibernate-jpa" ),
>                                 features( testingFeatureXmlUrl(),
> "hibernate-osgi-testing" )
>                 );
>         }
>
> P.S. `paxExamEnvironment` is a Properties I load from a prop file I create
> in Gradle in order to be able to test within my IDE as well as from Gradle.
> Those values are all accurate.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040643.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Add additional local maven repository - how?

Posted by Achim Nierbeck <bc...@googlemail.com>.
There you go, couldn't even read my own tests :D
it's supposed to be etc/...

thanks for spotting

regards, Achim

P.S. might be to late for today already ... so I should better go to bed ;)

2015-05-28 23:20 GMT+02:00 Stuart McCulloch <mc...@gmail.com>:

> On 28 May 2015 22:09, "sebersole" <st...@hibernate.org> wrote:
> >                                 editConfigurationFileExtend(
> >
> "org.ops4j.pax.url.mvn.cfg",
>
> shouldn't that be "etc/org.ops4j.pax.url.mvn.cfg" ?
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Add additional local maven repository - how?

Posted by Stuart McCulloch <mc...@gmail.com>.
On 28 May 2015 22:09, "sebersole" <st...@hibernate.org> wrote:
>                                 editConfigurationFileExtend(
>
"org.ops4j.pax.url.mvn.cfg",

shouldn't that be "etc/org.ops4j.pax.url.mvn.cfg" ?

Re: Add additional local maven repository - how?

Posted by sebersole <st...@hibernate.org>.
Achim,

That file was seemingly not touched.  The file has no mention of "modified
by paxexam" and the setting has no mention of my repo:

org.ops4j.pax.url.mvn.repositories= \
    http://repo1.maven.org/maven2@id=central, \
   
http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release,
\
   
http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external,
\
    http://zodiac.springsource.com/maven/bundles/release@id=gemini, \
   
http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases,
\
   
https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases,
\
   
https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases

Here is my @Configuration method:

		return options(
				when( debug ).useOptions( debugConfiguration( "5005", true ) ),
				karafDistributionConfiguration()
						.frameworkUrl( paxExamEnvironment.getProperty(
"org.ops4j.pax.exam.container.karaf.distroUrl" ) )
						.karafVersion( paxExamEnvironment.getProperty(
"org.ops4j.pax.exam.container.karaf.version" ) )
						.name( "Apache Karaf" )
						.unpackDirectory(
								new File(
										paxExamEnvironment.getProperty(
												"org.ops4j.pax.exam.container.karaf.unpackDir"
										)
								)
						)
						.useDeployFolder( false ),
				editConfigurationFileExtend(
						"org.ops4j.pax.url.mvn.cfg",
						"org.ops4j.pax.url.mvn.repositories",
						"https://repository.jboss.org/nexus/content/groups/public/"
				),
				configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
//				when( debug ).useOptions( keepRuntimeFolder() ),
				keepRuntimeFolder(),
				logLevel( LogLevelOption.LogLevel.INFO ),
				features( featureXmlUrl( paxExamEnvironment ), "hibernate-native",
"hibernate-jpa" ),
				features( testingFeatureXmlUrl(), "hibernate-osgi-testing" )
		);
	}

P.S. `paxExamEnvironment` is a Properties I load from a prop file I create
in Gradle in order to be able to test within my IDE as well as from Gradle. 
Those values are all accurate.



--
View this message in context: http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040643.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Add additional local maven repository - how?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Ok, in that case, check what the test-configuration actually did to this
file :-)

check the unpack directory, in that you should find a complete Karaf.
In there within the etc folder is the altered configuration file of yours.
The header of this file should also say something like "Modified by paxexm"
Make sure that your repository is correctly configured.

So it should look similar to this:
org.ops4j.pax.url.mvn.repositories =
http://repo1.maven.org/maven2@id=central,
http://repository.jboss.org/nexus/content/groups/public@id=jboss

regards, Achim


2015-05-28 22:29 GMT+02:00 sebersole <st...@hibernate.org>:

> That did not fix the problem though.  Same error.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040641.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Add additional local maven repository - how?

Posted by sebersole <st...@hibernate.org>.
That did not fix the problem though.  Same error. 



--
View this message in context: http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040641.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Add additional local maven repository - how?

Posted by sebersole <st...@hibernate.org>.
Boy, that's an unfortunate leakage.  Anyway, thanks (again) Achim! :)



--
View this message in context: http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040640.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Add additional local maven repository - how?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Steve,

is it a Karaf Pax-Exam test, or a "pure" OSGi test.
Cause both differ in resolving artifacts. The repository option you used
only works for "pure" OSGi tests.
If you have a Karaf-Container test, you'll need to alter the
org.ops4j.pax.url.mvn.cfg file within your test:

editConfigurationFileExtend("org.ops4j.pax.url.mvn.cfg",
"org.ops4j.pax.url.mvn.repositories", "
http://repository.jboss.org/nexus/content/groups/public/")

regards, Achim



2015-05-28 21:11 GMT+02:00 sebersole <st...@hibernate.org>:

> I am having trouble with this via Pax Exam.
>
> I have an artifact that is currently not available in Maven Central.  So I
> specify the appropriate repository in Pax Exam @Configuration method,
> using:
>
>     return options(
>             repositories(
>                     repository(
> "http://repository.jboss.org/nexus/content/groups/public/" )...
>             )
>     );
>
> However, I keep getting errors that the artifact cannot be resolved:
>
> shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Could not
> find artifact org.jboss.logging:jboss-logging:jar:3.3.0.Final in central
> (http://repo1.maven.org/maven2/)
>
> Is this just a bad error message?  Or is Karaf really only looking in Maven
> Central even though I (thought I) told it to look in JBoss Nexus as well?
>
> As you can see, the artifact is there...
>
>
> https://repository.jboss.org/nexus/content/groups/public/org/jboss/logging/jboss-logging/3.3.0.Final/
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-tp4028299p4040638.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master