help_maven.txt

steps for installation - S. Sharma, 01/23/2014 03:36 PM

Download (4.08 KB)

 
1
Steps to install RSB using jar files:
2
-------------------------------------
3

    
4
install maven
5

    
6
set up project
7
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
8

    
9
add rsb code 
10
download jar
11

    
12

    
13
give path for jars
14
mvn install:install-file -DgroupId=rsb -DartifactId=rsb -Dversion=0.11.0 -Dpackaging=jar -Dfile=/usr/share/java/rsb-0.11.0.jar
15
mvn install:install-file -DgroupId=rsb -DartifactId=protobuf -Dversion=2.4.1 -Dpackaging=jar -Dfile=/usr/share/java/protobuf-java-2.4.1.jar
16

    
17

    
18
add dependency in pom file :
19
<dependency>
20
		<groupId>rsb</groupId>
21
		<artifactId>rsb</artifactId>
22
		<version>0.11.0</version>
23
		<scope>compile</scope>
24
		<!--systemPath>/usr/share/java/rsb-0.11.0.jar</systemPath-->
25
	</dependency>
26
	<dependency>
27
		<groupId>rsb</groupId>
28
		<artifactId>protobuf</artifactId>
29
		<version>2.4.1</version>
30
		<scope>compile</scope>
31
		<!--systemPath>/usr/share/java/protobuf-java-2.4.1.jar</systemPath-->
32

    
33
</dependency>	
34

    
35

    
36
should compile with this , but if want executable jar to have dependency then add below lines to pom file:
37

    
38
<build>
39
<plugins>
40

    
41
<plugin>
42
    <groupId>org.apache.maven.plugins</groupId>
43
    <artifactId>maven-jar-plugin</artifactId>
44
    <version>2.2</version>
45
    <!-- nothing here -->
46
  </plugin>
47
  <plugin>
48
    <groupId>org.apache.maven.plugins</groupId>
49
    <artifactId>maven-assembly-plugin</artifactId>
50
    <version>2.2-beta-4</version>
51
    <configuration>
52
      <descriptorRefs>
53
        <descriptorRef>jar-with-dependencies</descriptorRef>
54
      </descriptorRefs>
55
      <archive>
56
        <manifest>
57
          <mainClass>org.sample.App</mainClass>
58
        </manifest>
59
      </archive>
60
    </configuration>
61
    <executions>
62
      <execution>
63
        <phase>package</phase>
64
        <goals>
65
          <goal>single</goal>
66
        </goals>
67
      </execution>
68
    </executions>
69
  </plugin>
70

    
71
 </plugins>
72
 </build>
73

    
74
run command:
75
mvn package
76

    
77
to compile with dependency :
78
 mvn clean dependency:copy-dependencies package
79

    
80
to run jar:
81
java -cp target/my-app-1.0-SNAPSHOT-jar-with-dependencies.jar com.mycompany.app.App
82

    
83

    
84
useful links:
85

    
86
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
87
http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
88
http://stackoverflow.com/questions/1814526/problem-building-executable-jar-with-maven
89
http://maven.apache.org/guides/mini/guide-configuring-plugins.html
90
http://docs.cor-lab.de/build%20system%20essentials-tutorial/trunk/html/build-system-java.html
91

    
92

    
93
output:
94
dragon@dragon:~/rsb/my-app$ java -cp target/my-app-1.0-SNAPSHOT-jar-with-dependencies.jar com.mycompany.app.App
95
19 Jan, 2014 8:09:17 PM rsb.transport.socket.BusServer$AcceptorThread run
96
INFO: Waiting for new client connection
97
19 Jan, 2014 8:09:18 PM rsb.transport.socket.BusServer deactivate
98
INFO: Trying to deactivate BusServer.
99
19 Jan, 2014 8:09:18 PM rsb.transport.socket.BusServer$AcceptorThread run
100
INFO: Shutting down due to request and closed socket.
101

    
102

    
103

    
104

    
105

    
106

    
107

    
108
Steps to install RSB from the source :
109
-------------------------------------
110

    
111

    
112
install maven
113

    
114
set up project
115
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
116

    
117

    
118

    
119
Installation of RSC and RSBProtocol:
120
Steps same as the steps for ant on CORLAB site 
121

    
122

    
123
Build and install RSC Library:
124
Steps same as the steps for ant on CORLAB site 
125

    
126
Need to edit this :
127
Step 2 and 3 on corlab site Build and install RSC Library
128
mkdir -p build && cd build 
129
no need of cd build as there are no cmake file in build folder and this gives error
130

    
131

    
132
need to specify what in "prefix" install dir is build dir or new dir
133

    
134
download rsb code for corlab site
135
run mvnprep.sh
136

    
137
changes in pom.xml
138

    
139
<properties>
140
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
141
        <pbuf.protopath>/homes/ssharma/rsb/proj/share/rsbprotocol0.11</pbuf.protopath>
142
        <pbuf.protoc>/usr/bin/protoc</pbuf.protoc>
143
        <pbuf.version>2.4.1</pbuf.version>
144
        <pbuf.outpath>target/generated-protocol</pbuf.outpath>
145
        <spread.daemon>/homes/ssharma/rsb/proj/sbin/spread</spread.daemon>
146
        <target.java.version>1.6</target.java.version>
147
    </properties>
148

    
149

    
150
mvn install
151
mvn test
152

    
153

    
154

    
155

    
156

    
157

    
158

    
159

    
160

    
161

    
162