Repository: karaf Updated Branches: refs/heads/karaf-3.0.x 6e336109d -> 9c6fccd6b
[KARAF-3031] Upgrade to Pax URL 2.1.0 [KARAF-2831] Use the Pax URL uber bundles [KARAF-2828] Use the system repo as default repository Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/9c6fccd6 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/9c6fccd6 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/9c6fccd6 Branch: refs/heads/karaf-3.0.x Commit: 9c6fccd6b376512fa73e92cfad83ed6062ce9d4f Parents: 6e33610 Author: Jean-Baptiste Onofré <[email protected]> Authored: Mon Sep 1 15:20:20 2014 +0200 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Mon Sep 1 15:20:20 2014 +0200 ---------------------------------------------------------------------- assemblies/features/framework/pom.xml | 79 +--- .../framework/src/main/feature/feature.xml | 6 +- .../resources/etc/org.ops4j.pax.url.mvn.cfg | 98 ----- .../resources/etc/org.ops4j.pax.url.mvn.cfg | 98 +++++ .../resources/etc/org.ops4j.pax.url.mvn.cfg | 98 ----- assemblies/features/standard/pom.xml | 2 + .../standard/src/main/feature/feature.xml | 6 +- bundle/core/pom.xml | 11 +- .../bundle/core/internal/BundleWatcherImpl.java | 2 +- .../core/internal/MavenConfigService.java | 78 ++-- itests/pom.xml | 8 +- kar/core/pom.xml | 7 +- .../karaf/kar/internal/KarServiceImpl.java | 2 +- pom.xml | 11 +- tooling/karaf-maven-plugin/pom.xml | 1 + .../org/apache/karaf/util/maven/Parser.java | 408 +++++++++++++++++++ 16 files changed, 603 insertions(+), 312 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/framework/pom.xml ---------------------------------------------------------------------- diff --git a/assemblies/features/framework/pom.xml b/assemblies/features/framework/pom.xml index 1622ac7..46b2995 100644 --- a/assemblies/features/framework/pom.xml +++ b/assemblies/features/framework/pom.xml @@ -89,16 +89,6 @@ <!-- listed in source feature.xml with explicit startlevel --> <dependency> - <groupId>biz.aQute.bnd</groupId> - <artifactId>bndlib</artifactId> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.ops4j.pax.logging</groupId> <artifactId>pax-logging-api</artifactId> </dependency> @@ -107,26 +97,12 @@ <artifactId>pax-logging-service</artifactId> </dependency> <dependency> - <groupId>org.ops4j.base</groupId> - <artifactId>ops4j-base-lang</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-maven-commons</artifactId> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-aether</artifactId> <exclusions> <exclusion> <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-maven-commons</artifactId> + <artifactId>pax-url-commons</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> @@ -137,20 +113,23 @@ <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-wrap</artifactId> + <classifier>uber</classifier> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.ops4j.pax.swissbox</groupId> - <artifactId>pax-swissbox-bnd</artifactId> - <exclusions> <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> + <groupId>org.ops4j.base</groupId> + <artifactId>ops4j-base-net</artifactId> + </exclusion> + <exclusion> + <groupId>org.ops4j.pax.swissbox</groupId> + <artifactId>pax-swissbox-bnd</artifactId> + </exclusion> + <exclusion> + <groupId>org.ops4j.pax.url</groupId> + <artifactId>pax-url-commons</artifactId> </exclusion> </exclusions> </dependency> @@ -449,38 +428,4 @@ </plugins> </build> - <profiles> - <profile> - <id>snapshot</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <build> - <resources> - <resource> - <directory>${project.basedir}/src/main/snapshot</directory> - <filtering>false</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - </resources> - </build> - </profile> - <profile> - <id>release</id> - <build> - <resources> - <resource> - <directory>${project.basedir}/src/main/release</directory> - <filtering>false</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - </resources> - </build> - </profile> - </profiles> - </project> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/framework/src/main/feature/feature.xml ---------------------------------------------------------------------- diff --git a/assemblies/features/framework/src/main/feature/feature.xml b/assemblies/features/framework/src/main/feature/feature.xml index 40bcca7..33db04a 100644 --- a/assemblies/features/framework/src/main/feature/feature.xml +++ b/assemblies/features/framework/src/main/feature/feature.xml @@ -22,12 +22,8 @@ including the correct start-level for the generation of the startup.propertie file --> <feature version="${project.version}" description="Karaf core feature" name="framework"> - <bundle start="true" start-level="5">mvn:org.ops4j.base/ops4j-base-lang/${pax.base.version}</bundle> - <bundle start="true" start-level="5">mvn:biz.aQute.bnd/bndlib/${bndlib.version}</bundle> - <bundle start="true" start-level="5">mvn:org.ops4j.pax.swissbox/pax-swissbox-bnd/${pax.swissbox.version}</bundle> - <bundle start="true" start-level="5">mvn:org.ops4j.pax.url/pax-url-maven-commons/${pax.url.version}</bundle> <bundle start="true" start-level="5">mvn:org.ops4j.pax.url/pax-url-aether/${pax.url.version}</bundle> - <bundle start="true" start-level="5">mvn:org.ops4j.pax.url/pax-url-wrap/${pax.url.version}</bundle> + <bundle start="true" start-level="5">mvn:org.ops4j.pax.url/pax-url-wrap/${pax.url.version}/jar/uber</bundle> <bundle start="true" start-level="8">mvn:org.ops4j.pax.logging/pax-logging-api/${pax.logging.version}</bundle> <bundle start="true" start-level="8">mvn:org.ops4j.pax.logging/pax-logging-service/${pax.logging.version}</bundle> <bundle start="true" start-level="10">mvn:org.apache.karaf.service/org.apache.karaf.service.guard/${project.version}</bundle> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/framework/src/main/release/resources/etc/org.ops4j.pax.url.mvn.cfg ---------------------------------------------------------------------- diff --git a/assemblies/features/framework/src/main/release/resources/etc/org.ops4j.pax.url.mvn.cfg b/assemblies/features/framework/src/main/release/resources/etc/org.ops4j.pax.url.mvn.cfg deleted file mode 100644 index 39d1ebe..0000000 --- a/assemblies/features/framework/src/main/release/resources/etc/org.ops4j.pax.url.mvn.cfg +++ /dev/null @@ -1,98 +0,0 @@ -################################################################################ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -################################################################################ - -# -# If set to true, the following property will not allow any certificate to be used -# when accessing Maven repositories through SSL -# -#org.ops4j.pax.url.mvn.certificateCheck= - -# -# Path to the local Maven settings file. -# The repositories defined in this file will be automatically added to the list -# of default repositories if the 'org.ops4j.pax.url.mvn.repositories' property -# below is not set. -# The following locations are checked for the existence of the settings.xml file -# * 1. looks for the specified url -# * 2. if not found looks for ${user.home}/.m2/settings.xml -# * 3. if not found looks for ${maven.home}/conf/settings.xml -# * 4. if not found looks for ${M2_HOME}/conf/settings.xml -# -#org.ops4j.pax.url.mvn.settings= - -# -# Path to the local Maven repository which is used to avoid downloading -# artifacts when they already exist locally. -# The value of this property will be extracted from the settings.xml file -# above, or defaulted to: -# System.getProperty( "user.home" ) + "/.m2/repository" -# -#org.ops4j.pax.url.mvn.localRepository= - -# -# Default this to false. It's just weird to use undocumented repos -# -org.ops4j.pax.url.mvn.useFallbackRepositories=false - -# -# Uncomment if you don't wanna use the proxy settings -# from the Maven conf/settings.xml file -# -# org.ops4j.pax.url.mvn.proxySupport=false - -# -# Comma separated list of repositories scanned when resolving an artifact. -# Those repositories will be checked before iterating through the -# below list of repositories and even before the local repository -# A repository url can be appended with zero or more of the following flags: -# @snapshots : the repository contains snaphots -# @noreleases : the repository does not contain any released artifacts -# -# The following property value will add the system folder as a repo. -# -org.ops4j.pax.url.mvn.defaultRepositories=\ - file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots,\ - file:${karaf.data}/kar@id=kar.repository@multi@snapshots - -# Use the default local repo (e.g.~/.m2/repository) as a "remote" repo -#org.ops4j.pax.url.mvn.defaultLocalRepoAsRemote=false - -# -# Comma separated list of repositories scanned when resolving an artifact. -# The default list includes the following repositories containing releases: -# http://repo1.maven.org/maven2 -# http://repository.springsource.com/maven/bundles/release -# http://repository.springsource.com/maven/bundles/external -# To add repositories to the default ones, prepend '+' to the list of repositories -# to add. -# A repository url can be appended with zero or more of the following flags: -# @snapshots : the repository contains snaphots -# @noreleases : the repository does not contain any released artifacts -# @id=reponid : the id for the repository, just like in the settings.xml this is optional but recomendet -# -# The default list doesn't contain any repository containing snapshots as it can impact the artifacts resolution. -# You may want to add the following repositories containing snapshots: -# http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases -# https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@norelease -# https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases -# -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://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/framework/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg ---------------------------------------------------------------------- diff --git a/assemblies/features/framework/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg b/assemblies/features/framework/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg new file mode 100644 index 0000000..2484c3d --- /dev/null +++ b/assemblies/features/framework/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg @@ -0,0 +1,98 @@ +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# +# If set to true, the following property will not allow any certificate to be used +# when accessing Maven repositories through SSL +# +#org.ops4j.pax.url.mvn.certificateCheck= + +# +# Path to the local Maven settings file. +# The repositories defined in this file will be automatically added to the list +# of default repositories if the 'org.ops4j.pax.url.mvn.repositories' property +# below is not set. +# The following locations are checked for the existence of the settings.xml file +# * 1. looks for the specified url +# * 2. if not found looks for ${user.home}/.m2/settings.xml +# * 3. if not found looks for ${maven.home}/conf/settings.xml +# * 4. if not found looks for ${M2_HOME}/conf/settings.xml +# +#org.ops4j.pax.url.mvn.settings= + +# +# Path to the local Maven repository which is used to avoid downloading +# artifacts when they already exist locally. +# The value of this property will be extracted from the settings.xml file +# above, or defaulted to: +# System.getProperty( "user.home" ) + "/.m2/repository" +# +#org.ops4j.pax.url.mvn.localRepository= + +# +# Default this to false. It's just weird to use undocumented repos +# +org.ops4j.pax.url.mvn.useFallbackRepositories=false + +# +# Uncomment if you don't wanna use the proxy settings +# from the Maven conf/settings.xml file +# +# org.ops4j.pax.url.mvn.proxySupport=false + +# +# Comma separated list of repositories scanned when resolving an artifact. +# Those repositories will be checked before iterating through the +# below list of repositories and even before the local repository +# A repository url can be appended with zero or more of the following flags: +# @snapshots : the repository contains snaphots +# @noreleases : the repository does not contain any released artifacts +# +# The following property value will add the system folder as a repo. +# +org.ops4j.pax.url.mvn.defaultRepositories=\ + file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots,\ + file:${karaf.data}/kar@id=kar.repository@multi@snapshots + +# Use the default local repo (e.g.~/.m2/repository) as a "remote" repo +#org.ops4j.pax.url.mvn.defaultLocalRepoAsRemote=false + +# +# Comma separated list of repositories scanned when resolving an artifact. +# The default list includes the following repositories: +# http://repo1.maven.org/maven2@id=central +# http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases +# http://repository.springsource.com/maven/bundles/release@id=spring.ebr +# http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external +# https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@norelease +# https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases +# To add repositories to the default ones, prepend '+' to the list of repositories +# to add. +# A repository url can be appended with zero or more of the following flags: +# @snapshots : the repository contains snapshots +# @noreleases : the repository does not contain any released artifacts +# @id=repository.id : the id for the repository, just like in the settings.xml this is optional but recommended +# +org.ops4j.pax.url.mvn.repositories= \ + http://repo1.maven.org/maven2@id=central, \ + http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \ + http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, \ + http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, \ + https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@norelease, \ + https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/framework/src/main/snapshot/resources/etc/org.ops4j.pax.url.mvn.cfg ---------------------------------------------------------------------- diff --git a/assemblies/features/framework/src/main/snapshot/resources/etc/org.ops4j.pax.url.mvn.cfg b/assemblies/features/framework/src/main/snapshot/resources/etc/org.ops4j.pax.url.mvn.cfg deleted file mode 100644 index 2484c3d..0000000 --- a/assemblies/features/framework/src/main/snapshot/resources/etc/org.ops4j.pax.url.mvn.cfg +++ /dev/null @@ -1,98 +0,0 @@ -################################################################################ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -################################################################################ - -# -# If set to true, the following property will not allow any certificate to be used -# when accessing Maven repositories through SSL -# -#org.ops4j.pax.url.mvn.certificateCheck= - -# -# Path to the local Maven settings file. -# The repositories defined in this file will be automatically added to the list -# of default repositories if the 'org.ops4j.pax.url.mvn.repositories' property -# below is not set. -# The following locations are checked for the existence of the settings.xml file -# * 1. looks for the specified url -# * 2. if not found looks for ${user.home}/.m2/settings.xml -# * 3. if not found looks for ${maven.home}/conf/settings.xml -# * 4. if not found looks for ${M2_HOME}/conf/settings.xml -# -#org.ops4j.pax.url.mvn.settings= - -# -# Path to the local Maven repository which is used to avoid downloading -# artifacts when they already exist locally. -# The value of this property will be extracted from the settings.xml file -# above, or defaulted to: -# System.getProperty( "user.home" ) + "/.m2/repository" -# -#org.ops4j.pax.url.mvn.localRepository= - -# -# Default this to false. It's just weird to use undocumented repos -# -org.ops4j.pax.url.mvn.useFallbackRepositories=false - -# -# Uncomment if you don't wanna use the proxy settings -# from the Maven conf/settings.xml file -# -# org.ops4j.pax.url.mvn.proxySupport=false - -# -# Comma separated list of repositories scanned when resolving an artifact. -# Those repositories will be checked before iterating through the -# below list of repositories and even before the local repository -# A repository url can be appended with zero or more of the following flags: -# @snapshots : the repository contains snaphots -# @noreleases : the repository does not contain any released artifacts -# -# The following property value will add the system folder as a repo. -# -org.ops4j.pax.url.mvn.defaultRepositories=\ - file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots,\ - file:${karaf.data}/kar@id=kar.repository@multi@snapshots - -# Use the default local repo (e.g.~/.m2/repository) as a "remote" repo -#org.ops4j.pax.url.mvn.defaultLocalRepoAsRemote=false - -# -# Comma separated list of repositories scanned when resolving an artifact. -# The default list includes the following repositories: -# http://repo1.maven.org/maven2@id=central -# http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases -# http://repository.springsource.com/maven/bundles/release@id=spring.ebr -# http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external -# https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@norelease -# https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases -# To add repositories to the default ones, prepend '+' to the list of repositories -# to add. -# A repository url can be appended with zero or more of the following flags: -# @snapshots : the repository contains snapshots -# @noreleases : the repository does not contain any released artifacts -# @id=repository.id : the id for the repository, just like in the settings.xml this is optional but recommended -# -org.ops4j.pax.url.mvn.repositories= \ - http://repo1.maven.org/maven2@id=central, \ - http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \ - http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, \ - http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, \ - https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@norelease, \ - https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/standard/pom.xml ---------------------------------------------------------------------- diff --git a/assemblies/features/standard/pom.xml b/assemblies/features/standard/pom.xml index b6d3549..71058ed 100644 --- a/assemblies/features/standard/pom.xml +++ b/assemblies/features/standard/pom.xml @@ -184,6 +184,7 @@ <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-obr</artifactId> + <classifier>uber</classifier> <scope>provided</scope> </dependency> <dependency> @@ -323,6 +324,7 @@ <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-war</artifactId> + <classifier>uber</classifier> <scope>provided</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/assemblies/features/standard/src/main/feature/feature.xml ---------------------------------------------------------------------- diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml index cf846b4..8832071 100644 --- a/assemblies/features/standard/src/main/feature/feature.xml +++ b/assemblies/features/standard/src/main/feature/feature.xml @@ -72,15 +72,11 @@ </feature> <feature name="obr" description="Provide OSGi Bundle Repository (OBR) support" version="${project.version}"> - <bundle dependency="true" start-level="30">mvn:commons-lang/commons-lang/${commons-lang.version}</bundle> - <bundle dependency="true" start-level="30">mvn:commons-collections/commons-collections/${commons-collections.version}</bundle> <bundle start-level="30">mvn:org.apache.felix/org.osgi.service.obr/${felix.obr.version}</bundle> <bundle start-level="30">mvn:org.apache.felix/org.apache.felix.bundlerepository/${felix.bundlerepository.version}</bundle> <bundle start-level="30">mvn:org.apache.karaf.obr/org.apache.karaf.obr.core/${project.version}</bundle> <bundle start-level="30">mvn:org.apache.karaf.obr/org.apache.karaf.obr.command/${project.version}</bundle> - <bundle start-level="30">mvn:org.ops4j.pax.swissbox/pax-swissbox-lifecycle/${pax.swissbox.version}</bundle> - <bundle start-level="30">mvn:org.ops4j.pax.swissbox/pax-swissbox-tracker/${pax.swissbox.version}</bundle> - <bundle start-level="30">mvn:org.ops4j.pax.url/pax-url-obr/${pax.url.version}</bundle> + <bundle start-level="30">mvn:org.ops4j.pax.url/pax-url-obr/${pax.url.version}/jar/uber</bundle> <bundle start-level="31">mvn:org.apache.karaf.features/org.apache.karaf.features.obr/${project.version}</bundle> </feature> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/bundle/core/pom.xml ---------------------------------------------------------------------- diff --git a/bundle/core/pom.xml b/bundle/core/pom.xml index 9ae6666..bf809d7 100644 --- a/bundle/core/pom.xml +++ b/bundle/core/pom.xml @@ -71,6 +71,11 @@ <artifactId>org.apache.felix.utils</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.apache.karaf</groupId> + <artifactId>org.apache.karaf.util</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.slf4j</groupId> @@ -103,13 +108,17 @@ <instructions> <Export-Package>org.apache.karaf.bundle.core</Export-Package> <Import-Package> + !org.apache.felix.utils.version, + !org.apache.felix.utils.manifest, + !org.apache.karaf.util.maven, org.apache.felix.service.command;status=provisional, * </Import-Package> <Private-Package> org.apache.karaf.bundle.core.internal, org.apache.felix.utils.version, - org.apache.felix.utils.manifest + org.apache.felix.utils.manifest, + org;apache.karaf.util.maven </Private-Package> </instructions> </configuration> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java ---------------------------------------------------------------------- diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java index 8e25955..07aee95 100644 --- a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java +++ b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleWatcherImpl.java @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.karaf.bundle.core.BundleService; import org.apache.karaf.bundle.core.BundleWatcher; -import org.ops4j.pax.url.mvn.Parser; +import org.apache.karaf.util.maven.Parser; import org.osgi.framework.*; import org.osgi.framework.wiring.FrameworkWiring; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/MavenConfigService.java ---------------------------------------------------------------------- diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/MavenConfigService.java b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/MavenConfigService.java index 7149ab0..ebdbbcc 100644 --- a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/MavenConfigService.java +++ b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/MavenConfigService.java @@ -17,19 +17,20 @@ package org.apache.karaf.bundle.core.internal; import java.io.File; -import java.io.IOException; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.util.Dictionary; -import org.ops4j.pax.url.maven.commons.MavenConfiguration; -import org.ops4j.pax.url.maven.commons.MavenConfigurationImpl; -import org.ops4j.pax.url.maven.commons.MavenRepositoryURL; -import org.ops4j.pax.url.mvn.ServiceConstants; -import org.ops4j.util.property.DictionaryPropertyResolver; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + public class MavenConfigService { private final Logger logger = LoggerFactory.getLogger(BundleWatcherImpl.class); @@ -40,35 +41,56 @@ public class MavenConfigService { } public File getLocalRepository() { - // Attempt to retrieve local repository location from MavenConfiguration - MavenConfiguration configuration = retrieveMavenConfiguration(); - if (configuration != null) { - MavenRepositoryURL localRepositoryURL = configuration.getLocalRepository(); - if (localRepositoryURL != null) { - return localRepositoryURL.getFile().getAbsoluteFile(); + String path = null; + try { + Configuration configuration = configurationAdmin.getConfiguration("org.ops4j.pax.url.mvn"); + if (configuration != null) { + Dictionary<String, Object> dict = configuration.getProperties(); + path = getLocalRepoFromConfig(dict); + } + } catch (Exception e) { + logger.error("Error retrieving maven configuration", e); + } + if (path == null) { + path = System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository"; + } + int index = path.indexOf('@'); + if (index > 0) { + return new File(path.substring(index)).getAbsoluteFile(); + } else { + return new File(path).getAbsoluteFile(); } - // If local repository not found assume default. - String localRepo = System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository"; - return new File(localRepo).getAbsoluteFile(); } - private MavenConfiguration retrieveMavenConfiguration() { - MavenConfiguration mavenConfiguration = null; - try { - Configuration configuration = configurationAdmin.getConfiguration(ServiceConstants.PID); - if (configuration != null) { - @SuppressWarnings("rawtypes") - Dictionary dictonary = configuration.getProperties(); - if (dictonary != null) { - DictionaryPropertyResolver resolver = new DictionaryPropertyResolver(dictonary); - mavenConfiguration = new MavenConfigurationImpl(resolver, ServiceConstants.PID); + static String getLocalRepoFromConfig(Dictionary<String, Object> dict) throws XMLStreamException, FileNotFoundException { + String path = null; + if (dict != null) { + path = (String) dict.get("org.ops4j.pax.url.mvn.localRepository"); + if (path == null) { + String settings = (String) dict.get("org.ops4j.pax.url.mvn.settings"); + if (settings != null) { + File file = new File(settings); + XMLStreamReader reader = XMLInputFactory.newFactory().createXMLStreamReader(new FileInputStream(file)); + try { + int event; + String elementName = null; + while ((event = reader.next()) != XMLStreamConstants.END_DOCUMENT) { + if (event == XMLStreamConstants.START_ELEMENT) { + elementName = reader.getLocalName(); + } else if (event == XMLStreamConstants.END_ELEMENT) { + elementName = null; + } else if (event == XMLStreamConstants.CHARACTERS && "localRepository".equals(elementName)) { + path = reader.getText().trim(); + } + } + } finally { + reader.close(); + } } } - } catch (IOException e) { - logger.error("Error retrieving maven configuration", e); } - return mavenConfiguration; + return path; } } http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/itests/pom.xml ---------------------------------------------------------------------- diff --git a/itests/pom.xml b/itests/pom.xml index f0ff7e7..dd7370d 100644 --- a/itests/pom.xml +++ b/itests/pom.xml @@ -61,12 +61,18 @@ <artifactId>pax-exam-container-karaf</artifactId> <scope>test</scope> </dependency> - <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-junit4</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-atinject_1.0_spec</artifactId> + <version>1.0</version> + </dependency> + <dependency> <groupId>org.apache.karaf.package</groupId> <artifactId>org.apache.karaf.package.core</artifactId> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/kar/core/pom.xml ---------------------------------------------------------------------- diff --git a/kar/core/pom.xml b/kar/core/pom.xml index b32b780..ea9d6fe 100644 --- a/kar/core/pom.xml +++ b/kar/core/pom.xml @@ -43,6 +43,10 @@ <artifactId>org.apache.felix.utils</artifactId> </dependency> <dependency> + <groupId>org.apache.karaf</groupId> + <artifactId>org.apache.karaf.util</artifactId> + </dependency> + <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> <scope>provided</scope> @@ -99,7 +103,8 @@ </Export-Package> <Private-Package> org.apache.karaf.kar.internal, - org.apache.felix.utils.properties + org.apache.felix.utils.properties, + org.apache.karaf.util.maven </Private-Package> </instructions> </configuration> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/kar/core/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java ---------------------------------------------------------------------- diff --git a/kar/core/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java b/kar/core/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java index 47c09f0..74db7b7 100644 --- a/kar/core/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java +++ b/kar/core/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java @@ -49,7 +49,7 @@ import org.apache.karaf.features.Feature; import org.apache.karaf.features.FeaturesService; import org.apache.karaf.features.Repository; import org.apache.karaf.kar.KarService; -import org.ops4j.pax.url.mvn.Parser; +import org.apache.karaf.util.maven.Parser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 43f4ab1..ca9c039 100644 --- a/pom.xml +++ b/pom.xml @@ -226,7 +226,7 @@ <pax.exam.version>4.1.0</pax.exam.version> <pax.logging.version>1.7.3</pax.logging.version> <pax.base.version>1.4.0</pax.base.version> - <pax.url.version>1.6.0</pax.url.version> + <pax.url.version>2.1.0</pax.url.version> <pax.web.version>3.1.2-SNAPSHOT</pax.web.version> <pax.swissbox.version>1.7.0</pax.swissbox.version> <pax.tinybundle.version>2.0.0</pax.tinybundle.version> @@ -1330,11 +1330,13 @@ <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-obr</artifactId> <version>${pax.url.version}</version> + <classifier>uber</classifier> </dependency> <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-war</artifactId> <version>${pax.url.version}</version> + <classifier>uber</classifier> </dependency> <dependency> @@ -1342,11 +1344,7 @@ <artifactId>ops4j-base-lang</artifactId> <version>${pax.base.version}</version> </dependency> - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-maven-commons</artifactId> - <version>${pax.url.version}</version> - </dependency> + <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-aether</artifactId> @@ -1406,6 +1404,7 @@ <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-wrap</artifactId> <version>${pax.url.version}</version> + <classifier>uber</classifier> </dependency> <dependency> <groupId>${servlet.spec.groupId}</groupId> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/tooling/karaf-maven-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/tooling/karaf-maven-plugin/pom.xml b/tooling/karaf-maven-plugin/pom.xml index 34b2c86..1f7b6c5 100644 --- a/tooling/karaf-maven-plugin/pom.xml +++ b/tooling/karaf-maven-plugin/pom.xml @@ -122,6 +122,7 @@ <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-wrap</artifactId> + <classifier>uber</classifier> </dependency> <dependency> <groupId>org.ops4j.pax.url</groupId> http://git-wip-us.apache.org/repos/asf/karaf/blob/9c6fccd6/util/src/main/java/org/apache/karaf/util/maven/Parser.java ---------------------------------------------------------------------- diff --git a/util/src/main/java/org/apache/karaf/util/maven/Parser.java b/util/src/main/java/org/apache/karaf/util/maven/Parser.java new file mode 100644 index 0000000..232942e --- /dev/null +++ b/util/src/main/java/org/apache/karaf/util/maven/Parser.java @@ -0,0 +1,408 @@ +/* + * Copyright 2007 Alin Dreghiciu. + * Copyright 2010,2011 Toni Menzel. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.karaf.util.maven; + +import java.net.MalformedURLException; + +/** + * Parser for mvn: protocol.<br/> + * + * @author Alin Dreghiciu + * @author Toni Menzel + * + * @since August 10, 2007 + */ +public class Parser +{ + + /** + * Default version if none present in the url. + */ + public static final String VERSION_LATEST = "LATEST"; + + /** + * Syntax for the url; to be shown on exception messages. + */ + private static final String SYNTAX = "mvn:[repository_url!]groupId/artifactId[/[version]/[type]]"; + + /** + * Separator between repository and artifact definition. + */ + private static final String REPOSITORY_SEPARATOR = "!"; + /** + * Artifact definition segments separator. + */ + private static final String ARTIFACT_SEPARATOR = "/"; + + /** + * Snapshot version + */ + private static final String VERSION_SNAPSHOT = "SNAPSHOT"; + /** + * Default type if not present in the url. + */ + private static final String TYPE_JAR = "jar"; + + /** + * Final artifact path separator. + */ + public static final String FILE_SEPARATOR = "/"; + /** + * Group id path separator. + */ + private static final String GROUP_SEPARATOR = "\\."; + /** + * Separator used to constructs the artifact file name. + */ + private static final String VERSION_SEPARATOR = "-"; + /** + * Artifact extension(type) separator. + */ + private static final String TYPE_SEPARATOR = "."; + /** + * Separator used to separate classifier in artifact name. + */ + private static final String CLASSIFIER_SEPARATOR = "-"; + /** + * Maven metadata file. + */ + private static final String METADATA_FILE = "maven-metadata.xml"; + /** + * Maven local metadata file. + */ + private static final String METADATA_FILE_LOCAL = "maven-metadata-local.xml"; + + /** + * Repository URL. Null if not present. + */ + private String m_repositoryURL; + /** + * Artifact group id. + */ + private String m_group; + /** + * Artifact id. + */ + private String m_artifact; + /** + * Artifact version. + */ + private String m_version; + /** + * Artifact type. + */ + private String m_type; + /** + * Artifact classifier. + */ + private String m_classifier; + /** + * Artifact classifier to use to build artifact name. + */ + private String m_fullClassifier; + + /** + * Creates a new protocol parser. + * + * @param path the path part of the url (without starting mvn:) + * + * @throws MalformedURLException if provided path does not comply to expected syntax or an malformed repository URL + */ + public Parser( final String path ) + throws MalformedURLException + { + if( path == null ) + { + throw new MalformedURLException( "Path cannot be null. Syntax " + SYNTAX ); + } + if( path.startsWith( REPOSITORY_SEPARATOR ) || path.endsWith( REPOSITORY_SEPARATOR ) ) + { + throw new MalformedURLException( + "Path cannot start or end with " + REPOSITORY_SEPARATOR + ". Syntax " + SYNTAX + ); + } + if( path.contains( REPOSITORY_SEPARATOR ) ) + { + int pos = path.lastIndexOf( REPOSITORY_SEPARATOR ); + parseArtifactPart( path.substring( pos + 1 ) ); + m_repositoryURL = path.substring( 0, pos ) + "@snapshots"; + } + else + { + parseArtifactPart( path ); + } + } + + /** + * Parses the artifact part of the url ( without the repository). + * + * @param part url part without protocol and repository. + * + * @throws MalformedURLException if provided path does not comply to syntax. + */ + private void parseArtifactPart( final String part ) + throws MalformedURLException + { + String[] segments = part.split( ARTIFACT_SEPARATOR ); + if( segments.length < 2 ) + { + throw new MalformedURLException( "Invalid path. Syntax " + SYNTAX ); + } + // we must have a valid group + m_group = segments[ 0 ]; + if( m_group.trim().length() == 0 ) + { + throw new MalformedURLException( "Invalid groupId. Syntax " + SYNTAX ); + } + // valid artifact + m_artifact = segments[ 1 ]; + if( m_artifact.trim().length() == 0 ) + { + throw new MalformedURLException( "Invalid artifactId. Syntax " + SYNTAX ); + } + // version is optional but we have a default value + m_version = VERSION_LATEST; + if( segments.length >= 3 && segments[ 2 ].trim().length() > 0 ) + { + m_version = segments[ 2 ]; + } + // type is optional but we have a default value + m_type = TYPE_JAR; + if( segments.length >= 4 && segments[ 3 ].trim().length() > 0 ) + { + m_type = segments[ 3 ]; + } + // classifier is optional (if not present or empty we will have a null classifier + m_fullClassifier = ""; + if( segments.length >= 5 && segments[ 4 ].trim().length() > 0 ) + { + m_classifier = segments[ 4 ]; + m_fullClassifier = CLASSIFIER_SEPARATOR + m_classifier; + } + } + + /** + * Returns the repository URL if present, null otherwise + * + * @return repository URL + */ + public String getRepositoryURL() + { + return m_repositoryURL; + } + + /** + * Returns the group id of the artifact. + * + * @return group Id + */ + public String getGroup() + { + return m_group; + } + + /** + * Returns the artifact id. + * + * @return artifact id + */ + public String getArtifact() + { + return m_artifact; + } + + /** + * Returns the artifact version. + * + * @return version + */ + public String getVersion() + { + return m_version; + } + + /** + * Returns the artifact type. + * + * @return type + */ + public String getType() + { + return m_type; + } + + /** + * Returns the artifact classifier. + * + * @return classifier + */ + public String getClassifier() + { + return m_classifier; + } + + /** + * Returns the complete path to artifact as stated by Maven 2 repository layout. + * + * @return artifact path + */ + public String getArtifactPath() + { + return getArtifactPath( m_version ); + } + + /** + * Returns the complete path to artifact as stated by Maven 2 repository layout. + * + * @param version The version of the artifact. + * + * @return artifact path + */ + public String getArtifactPath( final String version ) + { + return new StringBuilder() + .append( m_group.replaceAll( GROUP_SEPARATOR, FILE_SEPARATOR ) ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( FILE_SEPARATOR ) + .append( version ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( VERSION_SEPARATOR ) + .append( version ) + .append( m_fullClassifier ) + .append( TYPE_SEPARATOR ) + .append( m_type ) + .toString(); + } + + /** + * Returns the version for an artifact for a snapshot version. + * + * @param version The version of the snapshot. + * @param timestamp The timestamp of the snapshot. + * @param buildnumber The buildnumber of the snapshot. + * + * @return artifact path + */ + public String getSnapshotVersion( final String version, final String timestamp, final String buildnumber ) + { + return version.replace( VERSION_SNAPSHOT, timestamp ) + VERSION_SEPARATOR + buildnumber; + } + + /** + * Returns the complete path to artifact for a snapshot file. + * + * @param version The version of the snapshot. + * @param timestamp The timestamp of the snapshot. + * @param buildnumber The buildnumber of the snapshot. + * + * @return artifact path + */ + public String getSnapshotPath( final String version, final String timestamp, final String buildnumber ) + { + return new StringBuilder() + .append( m_group.replaceAll( GROUP_SEPARATOR, FILE_SEPARATOR ) ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( FILE_SEPARATOR ) + .append( version ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( VERSION_SEPARATOR ) + .append( getSnapshotVersion( version, timestamp, buildnumber ) ) + .append( m_fullClassifier ) + .append( TYPE_SEPARATOR ) + .append( m_type ) + .toString(); + } + + /** + * Returns the path to metdata file corresponding to this artifact version. + * + * @param version The version of the the metadata. + * + * @return metadata file path + */ + public String getVersionMetadataPath( final String version ) + { + return new StringBuilder() + .append( m_group.replaceAll( GROUP_SEPARATOR, FILE_SEPARATOR ) ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( FILE_SEPARATOR ) + .append( version ) + .append( FILE_SEPARATOR ) + .append( METADATA_FILE ) + .toString(); + } + + /** + * Returns the path to local metdata file corresponding to this artifact version. + * + * @param version The version of the the metadata. + * + * @return metadata file path + */ + public String getVersionLocalMetadataPath( final String version ) + { + return new StringBuilder() + .append( m_group.replaceAll( GROUP_SEPARATOR, FILE_SEPARATOR ) ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( FILE_SEPARATOR ) + .append( version ) + .append( FILE_SEPARATOR ) + .append( METADATA_FILE_LOCAL ) + .toString(); + } + + /** + * Returns the complete path to artifact local metadata file. + * + * @return artifact path + */ + public String getArtifactLocalMetdataPath() + { + return new StringBuilder() + .append( m_group.replaceAll( GROUP_SEPARATOR, FILE_SEPARATOR ) ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( FILE_SEPARATOR ) + .append( METADATA_FILE_LOCAL ) + .toString(); + } + + /** + * Returns the complete path to artifact metadata file. + * + * @return artifact path + */ + public String getArtifactMetdataPath() + { + return new StringBuilder() + .append( m_group.replaceAll( GROUP_SEPARATOR, FILE_SEPARATOR ) ) + .append( FILE_SEPARATOR ) + .append( m_artifact ) + .append( FILE_SEPARATOR ) + .append( METADATA_FILE ) + .toString(); + } + +}
