Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Ds 1343 - Add parent pom.xml and build.propertiesfiles into the binary release #119

Merged
merged 7 commits into from

4 participants

@tdonohue
Owner

This is a slightly updated version of Pull #112.

It merges Robin's changes in that Pull Request, along with the following additions:

  • Removes all "testEnvironment" stuff from the 'Binary' packaged release
  • Ensures that Unit Testing is turned off by default (necessary so Binary release doesn't attempt to run it)
  • Ensures that the testEnvironment.zip is only generated for the Source release (and NOT for Binary release)
  • Ensures the 'mvn package -Pdistribution' command (which builds SourceForge zip/tarball) still works properly, though now it needs to be run from [dspace-src]/dspace/ instead of [dspace-src]
@mdiggory
Owner

Interesting, the original dspace-parent pom used "if exists" by design previously, but we switched away from this to be able to disable specific modules from being built in maven.

My thought is that if we want to still be able to enable/disable modules, but also have a binary release with a dspace-parent pom, we will need to move all the dspace-xxx modules under a submodule that dspace-parent uses "if-exists" to enable

dspace-parent (profile with activation "if exists")
dspace-parent/modules
dspace-parent/modules/dspace-api
dspace-parent/modules/dspace-xmlui
dspace-parent/modules/dspace-jspui

exclude "modules" directory from release while allowing both binary and source release to use "mvn -P dspace-api,dspace-xmlui"

@tdonohue
Owner

Hi Mark,

Even with this pull request, you can still disable specific modules from being built.

For example, to build all of DSpace except for LNI & JSPUI:

mvn package -P!dspace-lni,!dspace-jspui

So, I don't think we're losing anything by moving to having "if exists" in the main (dspace-parent) POM. Obviously, you are correct that enabling only specific modules to build will no longer work (e.g. "mvn package -Pdspace-api,dspace-xmlui"). But, I'm not sure that is much of a loss?

However, I have noticed that this new "if exists" structure is causing a minor annoyance with creating distribution zip/tarballs (in that all of DSpace is re-compiled, when it's not necessary to recompile for zip/tarball generation).

So, I'm working on a fix to possibly move the zip/tarball assembly stuff over into the [src]/dspace/ subproject (alongside the main assembly.xml file). This seems to work well from my testing thus far, and actually helps to consolidate our multiple "assembly" options into one maven project.

@tdonohue
Owner

I've just force updated (git push -f) this pull request, as it got messed up after #112 was initially merged & then undone.

This force update does the following:

  • cherry picks three important commits from @robintaylor's #112 which were necessary
  • Adds two of my own commits to disable Unit testing by default, and also ensure the testEnvironment.zip is NOT built for the "binary" release of DSpace.

There's still a few minor things to take care of here, since the "mvn package -Pdistribution" command (which creates the zip/tarball distribution packages) is still acting slightly oddly. Will push those changes up in just a bit.

@helix84
Owner

Tim, would you mind documenting for posterity which particular commit breaks the -P behaviour?

@tdonohue tdonohue Move the zip/tarball creation assemblies (release.xml & src-release.x…
…ml) to [src]/dspace/src/main/assembly/

Also move the DSpace build assembly (assembly.xml) file to that directory as well, to consolidate.
a05f0d0
@tdonohue
Owner

@helix84,

It's the 52fb650 and 62007a0 commits (initially from #112). They change all the build "profiles" in the dspace-parent POM from being...

<activeByDefault>true</activeByDefault>

To being...

<file><exists>[module-name]/pom.xml</exists></file>

Those two commits have the side-effect of breaking "mvn package -Pdspace-api,dspace-xmlui" (which used to allow you to select only specific modules to build). The reason why is that all modules whose "pom.xml" file is found will be auto-executed (essentially the -P is ignored in this situation). However, you can still disable individual modules from building by doing something like "mvn package -P!dspace-lni,!dspace-jspui" (this would build everything except for the LNI & JSPUI).

To be clear though, the "file exists" changes are necessary if we wish to include the "dspace-parent" POM in the "binary" release of DSpace. And, at least at this point, we MUST include the "dspace-parent" POM in the "binary" release of DSpace, in order for the new "build.properties" stuff to work for the binary release. (see 0cb2e07 for these changes)

Hopefully that clarifies all the interwoven issues here.

@helix84
Owner

Hi Tim, thanks for the executive summary for us Maven dummies.

You mentioning auto-executing pom.xml files triggered some wheels in my head - this could be used as a method to build self-contained addons without any modifications to the upstream code. Richard and Joao were discussing addons recently on dspace-devel. But I expect I'm not the first one to think of that usage :)

Sorry for side-tracking and feel free to move this discussion to -devel if you want to reply.

@tdonohue tdonohue Move the 'distributions' profile (which creates the zip/tarball distr…
…ibutions) to the [src]/dspace/pom.xml. Minor updates (including enhanced comments) to all three of our Assemblies (assembly.xml, release.xml and src-release.xml), to ensure they all work properly when run from [src]/dspace/src/main/assembly/. Also minor updates to 'dspace-parent' and 'dspace' POM files. All these changes now fix issues with 'mvn package -Pdistributions'.
7e1b535
@tdonohue
Owner

Just pushed a few final commits (a05f0d0 and 7e1b535) to this pull request which do the following:

  • Move the src-release.xml and release.xml assemblies (used to build Sourceforge zip/tarballs) to [src]/dspace/src/main/assembly/ (and moved the "assembly.xml" there alongside it).
  • Enhanced the comments in each of these maven assembly docs, to better describe exactly what they are doing.
  • Updated the 'dspace-parent' & 'dspace' POMs to ensure that 'mvn package -Pdistributions' (which calls the src-release.xml and release.xml assemblies) works properly again. It now needs to be run from [src]/dspace/ though.

I've done some very thorough testing of these changes to ensure I didn't accidentally break anything in the build or release process. From my testing all of the following work great:

  • Normal builds (with or without unit tests enabled) from [dspace-src] or [dspace-src]/dspace/
  • Dry Run release works fine
  • Builds from a zip/tarball distribution (either the *-src-release or the *-release packages).

So, I think this Pull Request is ready to be merged!

@tdonohue
Owner

If no one has any objections, I'm going to merge this pull request tomorrow in time for RC3, that that we are able to ensure the *-release zip/tarballs can be tested during next week's testathon.

@tdonohue tdonohue merged commit a8cff6d into DSpace:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2012
  1. @robintaylor @tdonohue
  2. @robintaylor @tdonohue
  3. @robintaylor @tdonohue

    Check for the presence of the dspace module before activating it to f…

    robintaylor authored tdonohue committed
    …ix a mysterious problem with the test framework assembly
  4. @tdonohue

    Update dspace-parent POM to ONLY build the Unit Test Environment zip …

    tdonohue authored
    …when the testEnvironment.xml file exists. This ensures it will NOT be built for the 'binary' release of DSpace.
  5. @tdonohue

    Turn off Unit testing by default. This ensures that the "binary" rele…

    tdonohue authored
    …ase of DSpace won't attempt to run unit tests.
  6. @tdonohue

    Move the zip/tarball creation assemblies (release.xml & src-release.x…

    tdonohue authored
    …ml) to [src]/dspace/src/main/assembly/
    
    Also move the DSpace build assembly (assembly.xml) file to that directory as well, to consolidate.
  7. @tdonohue

    Move the 'distributions' profile (which creates the zip/tarball distr…

    tdonohue authored
    …ibutions) to the [src]/dspace/pom.xml. Minor updates (including enhanced comments) to all three of our Assemblies (assembly.xml, release.xml and src-release.xml), to ensure they all work properly when run from [src]/dspace/src/main/assembly/. Also minor updates to 'dspace-parent' and 'dspace' POM files. All these changes now fix issues with 'mvn package -Pdistributions'.
This page is out of date. Refresh to see the latest.
View
75 dspace/pom.xml
@@ -18,13 +18,6 @@
<version>3.0-rc3-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
-
- <!--
- Builds Overlay Modules for DSpace
- -->
- <modules>
- <module>modules</module>
- </modules>
<build>
<filters>
@@ -62,19 +55,24 @@
</resources>
<plugins>
- <!-- overall project assembly -->
+ <!-- Default project assembly. Calls 'assembly.xml', which
+ generates the DSpace build directory. -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
+ <!-- Don't "attach" the assembly results to this project. As
+ this assembly builds a directory, setting this to "true"
+ (default value) will just result in a WARNING message.-->
+ <attach>false</attach>
<descriptors>
- <descriptor>src/assemble/assembly.xml</descriptor>
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
- <goal>directory-single</goal>
+ <goal>single</goal>
</goals>
</execution>
</executions>
@@ -82,6 +80,63 @@
</plugins>
</build>
+ <profiles>
+
+ <!-- Default Profile. This builds all Overlay modules for DSpace -->
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <!--
+ Builds Overlay Modules for DSpace
+ -->
+ <modules>
+ <module>modules</module>
+ </modules>
+ </profile>
+
+
+ <!--
+ Run this profile (e.g. 'mvn package -Pdistributions') to create
+ zip / tarball distributions to upload to SourceForge or similar.
+ When this profile is run, DSpace is NOT compiled as normal.
+ Instead, a zip/tarball is generated from the parent [dspace-src] directory.
+ -->
+ <profile>
+ <id>distributions</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <inherited>false</inherited>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/release.xml</descriptor>
+ <descriptor>src/main/assembly/src-release.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>dspace-${project.version}</finalName>
+ </configuration>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
<dependencies>
<!-- This dependency ensures DSpace OAI JAR is added to [dspace]/lib/,
so that the 'dspace oai' launcher.xml command works. -->
View
42 dspace/src/assemble/assembly.xml → dspace/src/main/assembly/assembly.xml
@@ -7,6 +7,11 @@
http://www.dspace.org/license/
-->
+<!--
+ DSpace Directory Assembly
+ This assembly creates the 'target/dspace-[version]-build/' which can
+ then be installed via Apache Ant.
+-->
<assembly 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/assembly-1.1.0-SNAPSHOT.xsd">
@@ -17,6 +22,7 @@
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
+ <!-- Copy src/main/config/build.xml to resulting directory -->
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>.</outputDirectory>
@@ -24,6 +30,19 @@
<include>build.xml</include>
</includes>
</fileSet>
+ <!-- Copy README and LICENSE files to resulting directory -->
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>.</outputDirectory>
+ <includes>
+ <include>LICENSE*</include>
+ <include>README</include>
+ </includes>
+ <excludes>
+ <exclude>LICENSE_HEADER</exclude>
+ </excludes>
+ </fileSet>
+ <!-- Copy necessary subdirectories to resulting directory -->
<fileSet>
<outputDirectory>.</outputDirectory>
<includes>
@@ -32,18 +51,15 @@
<include>docs/**</include>
<include>etc/**</include>
<include>solr/**</include>
- <include>build.xml</include>
- <include>LICENSE*</include>
- <include>CHANGES</include>
- <include>KNOWN_BUGS</include>
- <include>README</include>
</includes>
+ <!-- Exclude source code & configs (we'll copy configs below) -->
<excludes>
<exclude>src</exclude>
<exclude>config/dspace.cfg</exclude>
<exclude>config/modules/**</exclude>
</excludes>
</fileSet>
+ <!-- Copy over all module configs & filter them -->
<fileSet>
<outputDirectory>.</outputDirectory>
<includes>
@@ -53,6 +69,7 @@
</fileSet>
</fileSets>
+ <!-- Copy over the dspace.cfg & filter it -->
<files>
<file>
<source>config/dspace.cfg</source>
@@ -62,8 +79,8 @@
</files>
<!--
- Still allow anyone to put a dependency into
- dspace/pom.xml and have it go into lib
+ Still allow anyone to put a JAR dependency into
+ [src]/dspace/pom.xml and have it go into 'lib' directory
-->
<dependencySets>
<dependencySet>
@@ -77,13 +94,10 @@
<moduleSets>
<!--
- take all jar modules in modules dir
- and add them into lib
+ Take all jar modules in [src]/dspace/modules/ dir
+ and add them into 'lib' directory
-->
<moduleSet>
- <excludes>
- <exclude>*:war:*</exclude>
- </excludes>
<includes>
<include>*:jar:*</include>
</includes>
@@ -103,8 +117,8 @@
</moduleSet>
<!--
- take all war modules and explode them into
- webapps
+ Take all war modules (in [src]/dspace/modules/) and explode them into
+ 'webapps' directory
-->
<moduleSet>
<includes>
View
20 src/main/assembly/release.xml → dspace/src/main/assembly/release.xml
@@ -8,6 +8,11 @@
http://www.dspace.org/license/
-->
+<!--
+ DSpace "Binary" Release Package Assembly
+ This assembly creates the binary (no source code) 'zip/tarball' distribution
+ of DSpace which can be made available via SourceForge or similar.
+-->
<assembly 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/assembly-1.1.0-SNAPSHOT.xsd">
@@ -17,25 +22,28 @@
<format>tar.gz</format>
<format>tar.bz2</format>
</formats>
- <includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>${finalName}-release</baseDirectory>
+ <includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<fileSet>
+ <!-- Select files from the parent directory (i.e. [dspace-src])-->
+ <directory>..</directory>
<useDefaultExcludes>true</useDefaultExcludes>
+ <!-- Include the "[src]/dspace/" folder & main README/build files -->
<includes>
<include>dspace/**</include>
- <include>LICENSE</include>
+ <include>LICENSE*</include>
<include>NOTICE</include>
<include>README</include>
- <include>CHANGES</include>
- <include>KNOWN_BUGS</include>
+ <include>build.properties</include>
+ <include>pom.xml</include>
</includes>
+ <!-- Exclude any target directories or dot files -->
<excludes>
<exclude>**/target/**</exclude>
- <exclude>make-release-package</exclude>
<exclude>.*</exclude>
</excludes>
</fileSet>
</fileSets>
-</assembly>
+</assembly>
View
9 src/main/assembly/src-release.xml → dspace/src/main/assembly/src-release.xml
@@ -8,6 +8,11 @@
http://www.dspace.org/license/
-->
+<!--
+ DSpace "Source" Release Package Assembly
+ This assembly creates the full source code 'zip/tarball' distribution
+ of DSpace which can be made available via SourceForge or similar.
+-->
<assembly 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/assembly-1.1.0-SNAPSHOT.xsd">
@@ -21,10 +26,12 @@
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<fileSet>
+ <!-- Select files from the parent directory (i.e. [dspace-src])-->
+ <directory>..</directory>
<useDefaultExcludes>true</useDefaultExcludes>
+ <!-- Include all files except target directories & dot files -->
<excludes>
<exclude>**/target/**</exclude>
- <exclude>make-release-package</exclude>
<exclude>.*</exclude>
</excludes>
</fileSet>
View
149 pom.xml
@@ -117,27 +117,7 @@
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/testEnvironment.xml</descriptor>
- </descriptors>
- <filters>
- <filter>src/main/filters/testEnvironment.properties</filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- <inherited>false</inherited>
- </plugin>
- <plugin>
+ <plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<configuration>
@@ -187,26 +167,67 @@
</goals>
</execution>
</executions>
- </plugin>
+ </plugin>
</plugins>
</build>
<profiles>
- <!--
+ <!-- This profile ensures that we ONLY generate the Unit Test Environment
+ if the testEnvironment.xml file is found. That way the Test Environment
+ is NOT built when running a 'mvn package' on a "binary" release. -->
+ <profile>
+ <id>generate-test-env</id>
+ <activation>
+ <file>
+ <exists>src/main/assembly/testEnvironment.xml</exists>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <!-- This plugin builds the testEnvironment.zip package
+ based on the specifications in testEnvironment.xml -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/testEnvironment.xml</descriptor>
+ </descriptors>
+ <filters>
+ <filter>src/main/filters/testEnvironment.properties</filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
+ <!--
These profiles activate the inclusion of various modules into
the DSpace Build process. They activate automatically if the
source module is in the local file system, correctly located
relative to this file.
-->
- <!--
- Builds central API for DSpace
+ <!--
+ Builds DSpace "Assembly & Configuration" project
-->
<profile>
<id>dspace</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace</module>
@@ -219,7 +240,9 @@
<profile>
<id>dspace-api</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-api/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-api</module>
@@ -232,7 +255,9 @@
<profile>
<id>dspace-services</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-services/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-services</module>
@@ -245,7 +270,9 @@
<profile>
<id>dspace-oai</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-oai/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-oai</module>
@@ -256,10 +283,11 @@
Builds JSPUI WAR for DSpace
-->
<profile>
-
<id>dspace-jspui</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-jspui/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-jspui</module>
@@ -273,7 +301,9 @@
<profile>
<id>dspace-sword</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-sword/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-sword</module>
@@ -286,7 +316,9 @@
<profile>
<id>dspace-swordv2</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-swordv2/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-swordv2</module>
@@ -299,7 +331,9 @@
<profile>
<id>dspace-xmlui</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-xmlui/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-xmlui</module>
@@ -312,7 +346,9 @@
<profile>
<id>dspace-lni</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <file>
+ <exists>dspace-lni/pom.xml</exists>
+ </file>
</activation>
<modules>
<module>dspace-lni</module>
@@ -342,49 +378,12 @@
</modules>
</profile>
- <!--
- Run this profile (e.g. 'mvn package -Pdistributions') to create
- zip / tarball distributions to upload to SourceForge or similar.
- -->
- <profile>
- <id>distributions</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <inherited>false</inherited>
- <executions>
- <execution>
- <inherited>false</inherited>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/release.xml</descriptor>
- <descriptor>src/main/assembly/src-release.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- <finalName>dspace-${project.version}</finalName>
- </configuration>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- skip tests by default, but allow override
- on command line by setting property "-Dmaven.test.skip"-->
- <!-- Disabled by default, change activeByDefault to true to enable -->
+ <!-- Skip Unit Tests by default, but allow override on command line
+ by setting property "-Dmaven.test.skip=false" -->
<profile>
<id>skiptests</id>
<activation>
- <activeByDefault>false</activeByDefault>
+ <activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.test.skip>true</maven.test.skip>
Something went wrong with that request. Please try again.