|
|
Re: How to create DP package with Maven via command line [message #1695496 is a reply to message #1695492] |
Fri, 15 May 2015 10:16 |
|
Hi,
I would like to propose a solution which would definitely be very easy in building a Deployment Package easily.
I have created several bundles for my Kura using Maven. For this, I have dedicated a specific folder for all of my Kura Bundles. So whenever I am building those bundles using Maven, I am getting a bundle jar in the target folder of each bundle. Now what I did is to create a General Project to create Deployment Package Definition (DPP) for my bundles. Basically Deployment Package Definition works as similar as Feature Project in Eclipse RCP Application Development.
Suppose I have the following bundles:
com.amitinside.bluecove - which bundles bluecove dependency and exposes javax.bluetooth
com.amitinside.bluecove.fragment - which bundles bluecove gpl fragment
com.amitinside.bluetooth - which bundles bluetooth application to pair devices
com.amitinside.bluetooth.milling.machine - which bundles application to retrieve data from bluetooth enabled devices
com.amitinside.dp.bluetooth - which is a General Project, comprising a Deployment Package Definition for bluecove, fragment and bluetooth bundles
com.amitinside.dp.bluetooth.machine - which is also a General Project, consisting of a Deployment Package Definition for milling machine bundle
com.amitinside.dp.dependencies - another General project for Deployment Package Definition, comprising Guava, Camel, mongo-db, commons-collections which are needed for resolving other bundles
All these afore mentioned projects are kept inside a dedicated folder. Now when I change something in any of my bundles, I build the application first using maven and I right click on my DPP Defition file, export it directly. At the time of export, I don't need to change anything as the DPP knows that the packaged bundle location is in target folder as we have already mentioned that while creating that General Project for Deployment Package Definition.
So, using this method, you don't need not to do menial works, whereas you can configure once and export it whenever you need the updated package. It helps me a lot as it saves me a lot of time.
Just remember to use Maven for creating all of your Kura Bundles and create DPP Projects and configure it to take the package bundles from target folder of your Kura Bundle projects. So, next time onwards, you just build your bundle after you apply your changes and just right click on your DPP file and click on export. That's it. It's simple and easy and moreover, a hassle free Deployment package creation.
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
[Updated on: Fri, 15 May 2015 10:17] Report message to a moderator
|
|
|
Re: How to create DP package with Maven via command line [message #1696514 is a reply to message #1695496] |
Tue, 26 May 2015 23:10 |
|
I have found a way to create Deployment Package using Maven.
The project structure what I have discussed above remained same. Now you have to do the following.
1. Right click on the dpp file
2. click on export
3. Under Deployment Package Definition, select Ant Build Script
4. Click on Finish
This will generate 2 files in the project directory
1. The Manifest File
2. Ant Build Script
Now I have created one parent pom project for all of my Deployment Package Definiton which has packaging set to pom and comprises one plugin to execute a shell script.
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Version Calculation</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/generate-dp.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
The shell script is as follows:
#!/bin/bash
declare -a arr=("de.tum.in.dp.bluetooth" "de.tum.in.dp.bluetooth.machine" "de.tum.in.dp.cache" "de.tum.in.dp.commons" "de.tum.in.dp.dependencies")
b="_build.xml"
c="/"
home_dir="/Users/AMIT/IoT_IDP/Pi/"
for i in "${arr[@]}"
do
echo "Generating Deployment Package for $i"
ant -buildfile $home_dir$i$c$i$b
done
You can try with maven-ant-run plugin to execute external build scripts.
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
Re: How to create DP package with Maven via command line [message #1696561 is a reply to message #1696514] |
Wed, 27 May 2015 09:29 |
|
The modified build script with proper comments for better comprehension.
#!/bin/bash
# Declaring all the Deployment Package Project Names to facilitate easy finding of
# its directory (as the directory name is as same as the project name)
declare -a arr=("de.tum.in.dp.bluetooth" "de.tum.in.dp.bluetooth.machine" "de.tum.in.dp.cache" "de.tum.in.dp.commons" "de.tum.in.dp.dependencies")
# The build file filename extension
b="_build.xml"
# The Directory Separator
c="/"
# The root directory of all the aforementioned projects.
home_dir="/Users/AMIT/IoT_IDP/Pi/"
# The DP file extension
ext=".dp"
# The destination directory to copy all deployment packages
cp_dir="/Users/AMIT/Downloads/"
for i in "${arr[@]}"
do
echo "Generating Deployment Package for $i"
# Run ant on the build file
/usr/local/bin/ant -d -buildfile $home_dir$i$c$i$b
# Move the deployment package to destination folder
mv $home_dir$i$c$i$ext $cp_dir
done
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
Re: How to create DP package with Maven via command line [message #1701345 is a reply to message #1696561] |
Sun, 12 July 2015 10:08 |
Nirmal Sasidharan Messages: 9 Registered: May 2014 |
Junior Member |
|
|
Deployment package seems to be more or less an obsolete OSGi solution for deployment. Although there are several other solutions like Eclipse P2, Apache KAR etc., all of them are proprietary. OSGi Subsystems in Spec 5 seems to be the standard OSGi way of doing it. Apache Aries provides an implementation for this. I got OSGi Subsystems working with Kura. Deployment for me is now as simple as creating a pom.xml with dependencies I want to deploy, use maven to build a subsystem file and ssh copy it over to a new "deploy" folder I created within Kura (I could have reused the existing "packages" folder. I wanted to intentionally separate them). The deployed plugins are dynamically loaded as soon as it is placed there (either jars or a subsystem file). Also no need to make entries in /opt/eclipse/kura/kura/dpa.properties.
I use the following projects to get it working.
Apache Aries 1.0.0 (aries.apache.org/modules/subsystems.html) [the latest Aries 2.x will not work as it needs Eclipse 3.10.x. Kura currently is based on 3.8.x]
Apache File Install (felix.apache.org/documentation/subprojects/apache-felix-file-install.html) to track the new "deploy" folder and install subsystem as soon as a new one is dropped (or updated/deleted). Example: svn.apache.org/repos/asf/aries/trunk/subsystem/subsystem-install/src/main/java/org/apache/aries/subsystem/install/internal/SubsystemInstaller.java
ESA Maven plugin (aries.apache.org/modules/esamavenpluginproject.html ) to create a subsystem ESA file (similar to DP file)
Helpful hints are available in this blog (coderthoughts.blogspot.de/2013/04/osgi-subsystems.html)
As a newbie with less than 5 messages, the forum doesn't let me add URLs here. Hence incomplete links. I hate spammers!!
[Updated on: Sun, 12 July 2015 10:13] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03144 seconds