summaryrefslogtreecommitdiffstats
path: root/maven-plugins/trunk/tuscany-zip-plugin/README
blob: 916e20cf0ddbd4b40c8c3b7c76c7dbd596bd6aec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
User Documentation
__________________

This module is a Maven plugin which supports the creation of a zip format SCA contribution from
the contents of a Maven project. An SCA contribution can be deployed to the Tuscany SCA runtime
and run as an application.

One of the main uses for an SCA zip contribution is that the SCA zip contribution can contain 
Java jar files within the zip and those jar files are available to the Java classloader of the 
contribution.  This enables the packaging of application Java classes along with any other Jar files
which they depend on in one contribution file. As a result the single zip file can hold everything
that's needed for the SCA application other than the Tuscany runtime itself - in one neat package.

The zip Maven plugin is used by adding a section into <build/> portion of the pom.xml of the Maven 
project which relates to the maven zip plugin.  It is also necessary for the packaging of the output 
of the project to be declared as "zip".  Then run Maven in the project.

This zip plugin builds the output of the project as an SCA zip archive and it includes any
jar files from dependencies declared by the project, where those dependency jar files are placed
into the zip archive in a folder with the name "lib".

An example pom.xml including the zip plugin statements:

   ...
   <!-- output packaging format is "zip" -->
   <packaging>zip</packaging>
   ... 
   <build>
      ...
      <!-- section referencing the Tuscany zip plugin -->
      <plugins>
      ...
         <plugin>
            <groupId>org.apache.tuscany.sca</groupId>
            <artifactId>tuscany-zip-plugin</artifactId>
            <extensions>true</extensions>
         </plugin>
      ...
      </plugins>
   </build>

(It is probably a good idea to now give an example of a complete POM containing one this stuff so that
users get the full context - I've attached one here, but it isn't the best example)

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<parent>
        <artifactId>tuscany-sca</artifactId>
        <groupId>org.apache.tuscany.sca</groupId>
        <version>2.0-SNAPSHOT</version>
    </parent>
	<groupId>org.inglenook.test1</groupId>
	<artifactId>mikestest</artifactId>
	<packaging>zip</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>quickstart</name>

	<dependencies>
		<!--  TUSCANY DEPENDENCIES -->
            <dependency>
               <groupId>org.apache.tuscany.sca</groupId>
               <artifactId>tuscany-sca-api</artifactId>
               <version>${tuscany.version}</version>
               <scope>provided</scope>
            </dependency>

		<!--  AN EXAMPLE APPLICATION DEPENDENCY TO BE INCLUDED IN ZIP -->
            <dependency>
               <groupId>commons-io</groupId>
               <artifactId>commons-io</artifactId>
               <version>1.4</version>
            </dependency>

		<!--  JUNIT DEPENDENCY FOR TESTING -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.2</version>
			<scope>test</scope>
		</dependency>

	</dependencies>
	<build>
            <defaultGoal>install</defaultGoal>
            <finalName>${artifactId}</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<directory>src/test/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.5</source>
					<target>1.5</target>
					<optimise>true</optimise>
					<debug>true</debug>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<configuration>
					<downloadSources>true</downloadSources>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.tuscany.sca</groupId>
				<artifactId>tuscany-zip-plugin</artifactId>
                        <extensions>true</extensions>
			</plugin>
			<plugin>
				<groupId>org.apache.tuscany.sca</groupId>
				<artifactId>tuscany-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
	<properties>
		<tuscany.version>2.0-SNAPSHOT</tuscany.version>
	</properties>
	</project>


TODOs: 
- make the "lib/" folder where the dependent jars go configurable
- make which dependencies get included configurable 
  (currently its those with compile or runtime scope)

---------------------------------
Building and releasing the plugin
---------------------------------

From the top tuscany-zip-plugin directory run maven:

mvn

or once all the dependencies have been downloaded and a succesful build run use:

mvn clean install -o

So as to avoid the Tuscany SCA project using SNAPSHOT dependencies any changes
to this tuscany-zip-plugin module should be released and the Tuscany SCA
project updated to use the newly released version.

To release this module:

mvn release:prepare

followed by: 

mvn release:perform

That will automatically create an SVN tag from the release, update the version 
numbers in the pom.xml files in the trunk and tag, and deploy the artifacts to the
staging repository defined by the <deploy.altRepository> in your Maven settings.xml.
While running it will prompt you for the names for the tag, release version etc.

In your maven settings.xml file you must have a server defined named "apache.releases",
and a profile named "release". For example:

  <servers>
    ...
    <server>
      <id>apache.releases</id>
      <username>antelder</username>
      <privateKey>\ant\id_dsa</privateKey>
      <passphrase>xxx</passphrase>
      <directoryPermissions>775</directoryPermissions>
      <filePermissions>664</filePermissions>
    </server>
  </servers>

  <profiles>
    ...
    <profile>
      <id>release</id>
      <properties>
        <gpg.passphrase>...</gpg.passphrase>
        <deploy.altRepository>apache.releases::default::scp://people.apache.org/home/antelder/public_html/tuscany/tuscany-zip-plugin-1.0</deploy.altRepository>
      </properties>
    </profile>
  </profiles>

Call a vote to release the module, eg: http://apache.markmail.org/message/6jnlfxbx7uklt5nv

After a successfule vote copy the staging artifacts to the live repository, eg: 

cp -p -v -R  tuscany-zip-plugin-alpha3/org/apache/tuscany/sca/ /x1/www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/tuscany/sca

-----------------------------------------------------------------------------
This Tuscany module includes much code copied from the Maven WAR plugin 2.0.2 
written by the Apache Maven team.
-----------------------------------------------------------------------------