You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Damien <ir...@gmail.com> on 2015/02/06 12:00:24 UTC

karaf-assembly and installed feature

Hello,

I'm a new apache karaf fan, and i'm trying some cool stuff like building a
custom distribution.

So i create a very basic and empty feature (following the dev guide)

mvn archetype:generate \
    -DarchetypeGroupId=org.apache.karaf.archetypes \
    -DarchetypeArtifactId=karaf-feature-archetype \
    -DarchetypeVersion=3.0.3-SNAPSHOT \
    -DgroupId=my.company \
    -DartifactId=my.company.feature \
    -Dversion=1.0-SNAPSHOT \
    -Dpackage=my.company.package

Then i want this feature to be installed in a custom distribution of karaf
so in my pom.xml:

<dependencies>
		<dependency>
			<groupId>my.company</groupId>
			<artifactId>my.company.feature</artifactId>
			<version>1.0-SNAPSHOT</version>
			<classifier>features</classifier>
			<type>xml</type>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>framework</artifactId>
			<version>${karaf.version}</version>
			<type>kar</type>
		</dependency>
		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>standard</artifactId>
			<version>${karaf.version}</version>
			<classifier>features</classifier>
			<type>xml</type>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>enterprise</artifactId>
			<version>${karaf.version}</version>
			<type>xml</type>
			<classifier>features</classifier>
			<scope>runtime</scope>
		</dependency>
	</dependencies>

And in the build :
<plugins>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.7</version>
				<executions>
					<execution>
						<id>process-resources</id>
						<goals>
							<goal>resources</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.apache.karaf.tooling</groupId>
				<artifactId>karaf-maven-plugin</artifactId>
				<extensions>true</extensions>
				<version>${karaf.version}</version>
				<configuration>
				<bootFeatures>
						<feature>standard</feature>
						<feature>management</feature>
						<feature>jndi</feature>
						<feature>jdbc</feature>
						<feature>*my.company.feature*</feature>
						<feature>jpa</feature>
						<feature>openjpa</feature>
				</bootFeatures>
				</configuration>
			</plugin>

The build is successfull but when i execute command feature:list -i. I can
see that jndi,jpa,openjpa etc ... are installed, but not the
"my.company.feature"

In org.apache.karaf.features.cfg : /featuresBoot /=
config,standard,region,package,kar,ssh,management,openjpa,jndi*,my.company.feature*,jdbc

But my feature repository is not listed in /featuresRepositories/

I expected my feature to be displayed  when i do the feature:list -i
command, am i right ? Do i misunderstand somthing ?

(my ${karaf.version} variable equals 3.0.3)



--
View this message in context: http://karaf.922171.n3.nabble.com/karaf-assembly-and-installed-feature-tp4038346.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: karaf-assembly and installed feature

Posted by Damien <ir...@gmail.com>.
Of course, but first thanks for your support:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	

	<groupId>karaf.try</groupId>
	<artifactId>karaf.assembly</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>karaf-assembly</packaging>
	
	<dependencies>
		<dependency>
			<groupId>my.company</groupId>
			<artifactId>my.company.feature</artifactId>
			<version>1.0-SNAPSHOT</version>
			<classifier>features</classifier>
			<type>xml</type>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>framework</artifactId>
			<version>${karaf.version}</version>
			<type>kar</type>
		</dependency>
		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>standard</artifactId>
			<version>${karaf.version}</version>
			<classifier>features</classifier>
			<type>xml</type>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>enterprise</artifactId>
			<version>${karaf.version}</version>
			<type>xml</type>
			<classifier>features</classifier>
			<scope>runtime</scope>
		</dependency>
	</dependencies>

	<build>
		
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
				<includes>
					<include>**/*</include>
				</includes>
			</resource>
			<resource>
				<directory>src/main/filtered-resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/*</include>
				</includes>
			</resource>
		</resources>

		<plugins>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.7</version>
				<executions>
					<execution>
						<id>process-resources</id>
						<goals>
							<goal>resources</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.apache.karaf.tooling</groupId>
				<artifactId>karaf-maven-plugin</artifactId>
				<extensions>true</extensions>
				<version>${karaf.version}</version>
				<configuration>
				
				<bootFeatures>
						<feature>standard</feature>
						<feature>management</feature>
						<feature>jndi</feature>
						<feature>jdbc</feature>
						<feature>my.company.feature</feature>
						<feature>jpa</feature>
						<feature>openjpa</feature>
				</bootFeatures>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<properties>
		<karaf.version>3.0.3</karaf.version>
	</properties>
</project>



Here is my feature pom.xml (autogenerated by karaf-feature-archetype)
<groupId>my.company</groupId>
    <artifactId>my.company.feature</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>feature</packaging>

    <name>my.company.feature-feature</name>
    <description>my.company.feature details</description>

    <dependencies>
        
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.karaf.tooling</groupId>
                    <artifactId>karaf-maven-plugin</artifactId>
                    <version>3.0.3</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>karaf-maven-plugin</artifactId>

                <configuration>
                    <startLevel>50</startLevel>
                    <aggregateFeatures>true</aggregateFeatures>
                    <resolver>(obr)</resolver>
                    <checkDependencyChange>true</checkDependencyChange>
                    <failOnDependencyChange>false</failOnDependencyChange>
                    <logDependencyChanges>true</logDependencyChanges>
                   
<overwriteChangedDependencies>true</overwriteChangedDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>





--
View this message in context: http://karaf.922171.n3.nabble.com/karaf-assembly-and-installed-feature-tp4038346p4038357.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: karaf-assembly and installed feature

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Damien,

can you share your pom with me ?

Thanks,
Regards
JB

On 02/06/2015 04:06 PM, Damien wrote:
> My bad, it's /<packaging>karaf-assembly</packaging>/.
>
> In fact i first create a feature via the /"karaf-feature-archetype"/, then i
> /"mvn install/" it.
>
> Next, I have followed the /"Custom Distribution" /tutorial, except that i
> have added a dependency to the feature. (scope = runtime)
>
> I also added a dependency to org.apache.karaf.features.dependencies in order
> to install jdbc, jpa, jndi, openjpa.
>
> /          <dependency>
> 			<groupId>org.apache.karaf.features</groupId>
> 			<artifactId>enterprise</artifactId>
> 			<version>${karaf.version}</version>
> 			<type>xml</type>
> 			<classifier>features</classifier>
> 			<scope>runtime</scope>
> 		</dependency>/
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/karaf-assembly-and-installed-feature-tp4038346p4038352.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

RE: karaf-assembly and installed feature

Posted by Damien <ir...@gmail.com>.
My bad, it's /<packaging>karaf-assembly</packaging>/. 

In fact i first create a feature via the /"karaf-feature-archetype"/, then i
/"mvn install/" it. 

Next, I have followed the /"Custom Distribution" /tutorial, except that i
have added a dependency to the feature. (scope = runtime)

I also added a dependency to org.apache.karaf.features.dependencies in order
to install jdbc, jpa, jndi, openjpa.

/          <dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>enterprise</artifactId>
			<version>${karaf.version}</version>
			<type>xml</type>
			<classifier>features</classifier>
			<scope>runtime</scope>
		</dependency>/





--
View this message in context: http://karaf.922171.n3.nabble.com/karaf-assembly-and-installed-feature-tp4038346p4038352.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

RE: karaf-assembly and installed feature

Posted by Damien <ir...@gmail.com>.
Hello Jean-Baptiste

Yes my pom has packaging <packaging>karaf.assembly</packaging> and has

		/<dependency>
			<groupId>my.company</groupId>
			<artifactId>my.company.feature</artifactId>
			<version>1.0-SNAPSHOT</version>
			<classifier>features</classifier>
			<type>xml</type>
			<scope>runtime</scope>
		</dependency>/

in dependencies.

Regards 



--
View this message in context: http://karaf.922171.n3.nabble.com/karaf-assembly-and-installed-feature-tp4038346p4038348.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.