Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added documentation + improvements

  • Loading branch information...
commit 36101e7ea3e3952fcecae2cb9563040a5b24cabf 1 parent 4dc40a2
Tibor Digana authored
136 pom.xml
View
@@ -212,9 +212,12 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</developers>
<contributors>
<contributor>
- <name>Tibor Digana</name>
+ <name>JUnit contributors</name>
+ <organization>JUnit</organization>
+ <email>junit@yahoogroups.com</email>
+ <url>https://github.com/KentBeck/junit/graphs/contributors</url>
<roles>
- <role>developer</role>
+ <role>developers</role>
</roles>
</contributor>
</contributors>
@@ -235,14 +238,24 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</dependencies>
<distributionManagement>
<downloadUrl>http://sourceforge.net/projects/junit/</downloadUrl>
- <repository>
+ <!--
+ Currently the deployment is under development and enabled for
+ the Snapshot Repository of the Maven Central.
+ -->
+ <snapshotRepository>
<id>sonatype-nexus-staging</id>
<name>upload.to.maven.central</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
- <!--
- <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
- -->
+ </snapshotRepository>
+ <!--
+ The Release Repository is temporarily disabled until the Maven build process
+ is officially proved to deploy to the Maven Central.
+ <repository>
+ <id>sonatype-nexus-staging</id>
+ <name>upload.to.maven.central</name>
+ <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
+ -->
</distributionManagement>
<build>
<resources>
@@ -257,6 +270,13 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</resource>
</resources>
<extensions>
+ <!--
+ Specify HTTP and FTP providers.
+ The Maven Wagon is a transport abstraction.
+ For more information see http://maven.apache.org/wagon/index.html
+ and the guide
+ http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html
+ -->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
@@ -269,7 +289,29 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</extension>
</extensions>
<plugins>
+ <!--
+ Both "org.apache" and "org.codehaus" are default providers of MOJO plugins
+ which are especially dedicated to Maven projects.
+ The MOJO stands for "Maven plain Old Java Object".
+ Each mojo is an executable goal in Maven, and a plugin is a distribution of
+ one or more related mojos.
+ For more information see http://maven.apache.org/plugin-developers/index.html
+
+ The following plugins are ordered according the Maven build lifecycle.
+ http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
+ -->
<plugin>
+ <!--
+ Assigns properties with prefix "junit"
+ For instance, project version 4.11-SNAPSHOT is parsed
+ and the following properties handle the values:
+ junit.majorVersion=4
+ junit.minorVersion=11
+ junit.incrementalVersion=0
+ junit.qualifier=SNAPSHOT
+ junit.buildNumber=0
+ These are handled in a profile with id "checkSnapshot".
+ -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
@@ -288,6 +330,11 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</executions>
</plugin>
<plugin>
+ <!--
+ Checks that the version of user's maven installation is 3.0.4,
+ the JDK is 1.5+, no non-standard repositories are specified in
+ the project, requires only release versions of dependencies of other artifacts.
+ -->
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<executions>
@@ -303,15 +350,15 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
<requireMavenVersion>
<message>Current version of Maven ${maven.version} required to build the project should be ${project.prerequisites.maven}, or higher!</message>
<version>${project.prerequisites.maven}</version>
- </requireMavenVersion>
- <requireJavaVersion>
- <message>Current JDK version ${java.version} should be ${jdkVersion}, or higher!</message>
- <version>${jdkVersion}</version>
- </requireJavaVersion>
- <requireNoRepositories>
- <message>Best Practice is to never define repositories in pom.xml (use a repository manager instead).</message>
- </requireNoRepositories>
- <requireReleaseDeps>
+ </requireMavenVersion>
+ <requireJavaVersion>
+ <message>Current JDK version ${java.version} should be ${jdkVersion}, or higher!</message>
+ <version>${jdkVersion}</version>
+ </requireJavaVersion>
+ <requireNoRepositories>
+ <message>Best Practice is to never define repositories in pom.xml (use a repository manager instead).</message>
+ </requireNoRepositories>
+ <requireReleaseDeps>
<message>No Snapshots Dependencies Allowed!</message>
</requireReleaseDeps>
</rules>
@@ -320,6 +367,9 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</executions>
</plugin>
<plugin><!-- Using jdk 1.5.0_22, package-info.java files are compiled correctly. -->
+ <!--
+ java compiler plugin forked in extra process
+ -->
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
@@ -336,6 +386,10 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</configuration>
</plugin>
<plugin>
+ <!--
+ A plugin which uses the JUnit framework in order to start
+ our junit suite "AllTests" after the sources are compiled.
+ -->
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.3</version>
<configuration>
@@ -343,15 +397,12 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
<useSystemClassLoader>true</useSystemClassLoader>
<enableAssertions>false</enableAssertions>
</configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>surefire-junit47</artifactId>
- <version>2.12.3</version>
- </dependency>
- </dependencies>
</plugin>
<plugin>
+ <!--
+ This plugin can package the main artifact's sources (src/main/java)
+ in to jar archive. See target/junit-*-sources.jar .
+ -->
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
@@ -365,12 +416,17 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</executions>
</plugin>
<plugin>
+ <!--
+ This plugin can generate Javadoc by a forked
+ process and then package the Javadoc in jar archive
+ target/junit-*-javadoc.jar .
+ -->
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>attach-javadoc</id>
- <phase>prepare-package</phase>
+ <phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
@@ -407,6 +463,11 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</executions>
</plugin>
<plugin>
+ <!--
+ This plugin fabricates a zip file including the traditional content
+ (sources, archives, Javadoc, and JUnit documentation)
+ before deploying to sourceforge.
+ -->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
@@ -426,6 +487,14 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</executions>
</plugin>
<plugin>
+ <!--
+ The goal is to modify the SNAPSHOT version of development
+ to a release version. See the profile with id "checkSnapshot".
+ The plugin does not have a default phase to execute, thus you
+ can execute it in command line:
+ mvn -f pom.xml release:update-versions
+ See the Makefile.
+ -->
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration><!-- import release version without user's prompt if non-empty property value; otherwise prompt -->
@@ -433,12 +502,18 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</configuration>
</plugin>
<plugin>
+ <!--
+ This wagon plugin uploads all jar archives and one zip file
+ to the sourceforge FTP server.
+ See the credentials for serve id "sourceforge-staging"
+ in src/main/config/settings.xml .
+ -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-4</version>
<executions>
<execution>
- <id>upload-javadoc</id>
+ <id>upload-to-sourceforge</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
@@ -458,6 +533,11 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
<profiles>
<profile>
<id>checkRelease</id>
+ <!--
+ Purpose:
+ This section will check that the version is a release.
+ The release artifacts are deployed to Maven central release repository.
+ -->
<build>
<plugins>
<plugin>
@@ -486,6 +566,14 @@ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
</profile>
<profile>
<id>checkSnapshot</id>
+ <!--
+ Purpose:
+ This section will check the version is a snapshot and has
+ a correct form of "<major>.<minor>-SNAPSHOT" when preparing release.
+ An incremental version (like 4.11.x-SNAPSHOT) is not JUnit standard.
+ So if you mistakenly specify the incremental version, the build
+ fails. Same if "SNAPSHOT" qualifier is missing.
+ -->
<build>
<plugins>
<plugin>
2  src/main/assembly/src.xml
View
@@ -33,7 +33,7 @@
<directoryMode>0755</directoryMode>
<includes>
<include>${groupId}:${artifactId}:${packaging}</include>
- <include>org.hamcrest:hamcrest-core</include>
+ <include>org.hamcrest:hamcrest-core</include>
</includes>
</dependencySet>
</dependencySets>
247 src/main/config/settings.xml
View
@@ -1,48 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<!--
- | This is the configuration file for Maven. It can be specified at two levels:
- |
- | 1. User Level. This settings.xml file provides configuration for a single user,
- | and is normally provided in ${user.home}/.m2/settings.xml.
- |
- | NOTE: This location can be overridden with the CLI option:
- |
- | -s /path/to/user/settings.xml
- |
- | 2. Global Level. This settings.xml file provides configuration for all Maven
- | users on a machine (assuming they're all using the same Maven
- | installation). It's normally provided in
- | ${maven.home}/conf/settings.xml.
- |
- | NOTE: This location can be overridden with the CLI option:
- |
- | -gs /path/to/global/settings.xml
- |
- | The sections in this sample file are intended to give you a running start at
- | getting the most out of your Maven installation. Where appropriate, the default
- | values (values used when the setting is not specified) are provided.
- |
- |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
@@ -52,91 +8,19 @@ under the License.
| Default: ~/.m2/repository
### The path to the local repository maven in JUnit Project ###
- See Makefile of a junit build process at the top level files descriptive of the project pom.xml and pom-dep.xml.
+ See Makefile of a junit build process at the top level files descriptive of the project pom.xml.
The variable LOCAL_REPO=~/.m2/repository already specified local repo.
- In pom.xml and pom-dep.xml, we rely on a value ${user.home}/.m2/repository.
+ In pom.xml, we rely on a value ${user.home}/.m2/repository.
The maven-invoker-plugin changes basedir upon nested projects and therefore it cannot rely on this relative path in <localRepository/>.
An absolute path is not acceptable, because it's platform dependent; however <localRepository/> can be used in IDE.
The system property "maven.repo.local" has higher priority in the build process where declared.
-->
<localRepository>${user.home}/.m2/repository</localRepository>
-
- <!-- interactiveMode
- | This will determine whether maven prompts you when it needs input. If set to false,
- | maven will use a sensible default value, perhaps based on some other setting, for
- | the parameter in question.
- |
- | Default: true
- <interactiveMode>true</interactiveMode>
- -->
-
- <!-- offline
- | Determines whether maven should attempt to connect to the network when executing a build.
- | This will have an effect on artifact downloads, artifact deployment, and others.
- |
- | Default: false
- <offline>false</offline>
- -->
-
- <!-- pluginGroups
- | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
- | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
- | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
- |-->
- <pluginGroups>
- <!-- pluginGroup
- | Specifies a further group identifier to use for plugin lookup.
- <pluginGroup>com.your.plugins</pluginGroup>
- -->
- </pluginGroups>
-
- <!-- proxies
- | This is a list of proxies which can be used on this machine to connect to the network.
- | Unless otherwise specified (by system property or command-line switch), the first proxy
- | specification in this list marked as active will be used.
- |-->
- <proxies>
- <!-- proxy
- | Specification for one proxy, to be used in connecting to the network.
- |
- <proxy>
- <id>optional</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>proxyuser</username>
- <password>proxypass</password>
- <host>proxy.host.net</host>
- <port>80</port>
- <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
- </proxy>
- -->
- </proxies>
-
- <!-- servers
- | This is a list of authentication profiles, keyed by the server-id used within the system.
- | Authentication profiles can be used whenever maven must make a connection to a remote server.
- |-->
+
<servers>
- <!-- server
+ <!--
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
- |
- | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
- | used together.
- |
- <server>
- <id>deploymentRepo</id>
- <username>repouser</username>
- <password>repopwd</password>
- </server>
- -->
-
- <!-- Another sample, using keys to authenticate.
- <server>
- <id>siteServer</id>
- <privateKey>/path/to/private/key</privateKey>
- <passphrase>optional; leave empty if not used.</passphrase>
- </server>
-->
<server>
<id>sonatype-nexus-staging</id>
@@ -165,127 +49,4 @@ under the License.
</configuration>
</server>
</servers>
-
- <!-- mirrors
- | This is a list of mirrors to be used in downloading artifacts from remote repositories.
- |
- | It works like this: a POM may declare a repository to use in resolving certain artifacts.
- | However, this repository may have problems with heavy traffic at times, so people have mirrored
- | it to several places.
- |
- | That repository definition will have a unique id, so we can create a mirror reference for that
- | repository, to be used as an alternate download site. The mirror site will be the preferred
- | server for that repository.
- |-->
- <mirrors>
- <!-- mirror
- | Specifies a repository mirror site to use instead of a given repository. The repository that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- <mirror>
- <id>mirrorId</id>
- <mirrorOf>repositoryId</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://my.repository.com/repo/path</url>
- </mirror>
- -->
- </mirrors>
-
- <!-- profiles
- | This is a list of profiles which can be activated in a variety of ways, and which can modify
- | the build process. Profiles provided in the settings.xml are intended to provide local machine-
- | specific paths and repository locations which allow the build to work in the local environment.
- |
- | For example, if you have an integration testing plugin - like cactus - that needs to know where
- | your Tomcat instance is installed, you can provide a variable here such that the variable is
- | dereferenced during the build process to configure the cactus plugin.
- |
- | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
- | section of this document (settings.xml) - will be discussed later. Another way essentially
- | relies on the detection of a system property, either matching a particular value for the property,
- | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
- | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
- | Finally, the list of active profiles can be specified directly from the command line.
- |
- | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
- | repositories, plugin repositories, and free-form properties to be used as configuration
- | variables for plugins in the POM.
- |
- |-->
- <profiles>
- <!-- profile
- | Specifies a set of introductions to the build process, to be activated using one or more of the
- | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
- | or the command line, profiles have to have an ID that is unique.
- |
- | An encouraged best practice for profile identification is to use a consistent naming convention
- | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
- | This will make it more intuitive to understand what the set of introduced profiles is attempting
- | to accomplish, particularly when you only have a list of profile id's for debug.
- |
- | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
- <profile>
- <id>jdk-1.4</id>
-
- <activation>
- <jdk>1.4</jdk>
- </activation>
-
- <repositories>
- <repository>
- <id>jdk14</id>
- <name>Repository for JDK 1.4 builds</name>
- <url>http://www.myhost.com/maven/jdk14</url>
- <layout>default</layout>
- <snapshotPolicy>always</snapshotPolicy>
- </repository>
- </repositories>
- </profile>
- -->
-
- <!--
- | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
- | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
- | might hypothetically look like:
- |
- | ...
- | <plugin>
- | <groupId>org.myco.myplugins</groupId>
- | <artifactId>myplugin</artifactId>
- |
- | <configuration>
- | <tomcatLocation>${tomcatPath}</tomcatLocation>
- | </configuration>
- | </plugin>
- | ...
- |
- | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
- | anything, you could just leave off the <value/> inside the activation-property.
- |
- <profile>
- <id>env-dev</id>
-
- <activation>
- <property>
- <name>target-env</name>
- <value>dev</value>
- </property>
- </activation>
-
- <properties>
- <tomcatPath>/path/to/tomcat/instance</tomcatPath>
- </properties>
- </profile>
- -->
- </profiles>
-
- <!-- activeProfiles
- | List of profiles that are active for all builds.
- |
- <activeProfiles>
- <activeProfile>alwaysActiveProfile</activeProfile>
- <activeProfile>anotherAlwaysActiveProfile</activeProfile>
- </activeProfiles>
- -->
</settings>
29 src/main/java/junit/runner/Version.java
View
@@ -8,20 +8,7 @@
* This class defines the current version of JUnit
*/
public class Version {
- private static final String VERSION;
- static {
- try {
- final Properties properties= new Properties();
- InputStream pomProps= getPomPropertiesAsStream("junit");
- if (pomProps == null) pomProps= getPomPropertiesAsStream("junit-dep");
- if (pomProps != null) properties.load(pomProps);
- VERSION= properties.getProperty("version", "<version>");
- if (pomProps != null) pomProps.close();
- assert !VERSION.equals("<version>") : "your class loader does not load resources at /META-INF/maven/junit/...";
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
+ private static final String VERSION = getVersion();
private Version() {
// don't instantiate
@@ -38,4 +25,18 @@ public static void main(String[] args) {
private static InputStream getPomPropertiesAsStream(String artifactId) {
return Version.class.getResourceAsStream("/META-INF/maven/junit/" + artifactId + "/pom.properties");
}
+
+ private static String getVersion() {
+ try {
+ final Properties properties= new Properties();
+ InputStream pomProps= getPomPropertiesAsStream("junit");
+ if (pomProps != null) properties.load(pomProps);
+ String version= properties.getProperty("version", "<version>");
+ if (pomProps != null) pomProps.close();
+ assert !version.equals("<version>") : "your class loader does not load resources at /META-INF/maven/junit/...";
+ return version;
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
}
2  src/main/javadoc/stylesheet.css
View
@@ -1 +1 @@
-/* Javadoc style sheet */
+/* Javadoc style sheet */
Please sign in to comment.
Something went wrong with that request. Please try again.