Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add automatic Maven POM generation

  • Loading branch information...
commit 4b7259c4f44ebe4114167dc9077f7662335e8832 1 parent 9d0c9eb
@cbeams cbeams authored
Showing with 173 additions and 9 deletions.
  1. +7 −2 .gitignore
  2. +1 −7 build.gradle
  3. +108 −0 pom.xml
  4. +57 −0 src/build/admin-tasks.gradle
View
9 .gitignore
@@ -5,11 +5,16 @@
# ignore Eclipse metadata (users should run `gradle eclipse` to generate)
.classpath
.project
+.settings
+
+# ignore Eclipse output dir
+bin
+
+# ignore Maven output dir
+target
# ignore IDEA metadata (users should run `gradle idea` to generate)
*.iml
*.ipr
*.iws
-.settings
-bin
*.sw*
View
8 build.gradle
@@ -4,6 +4,7 @@ version = '1.0.0.SNAPSHOT'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
+apply from: 'src/build/admin-tasks.gradle'
repositories {
mavenRepo urls: 'http://maven.springframework.org/milestone'
@@ -39,10 +40,3 @@ sourceSets {
}
}
-task wrapper(type: Wrapper) {
- group = 'Admin'
- description = "Generates gradlew and gradlew.bat bootstrap scripts"
- gradleVersion = '0.9.2'
- // place jar file and properties into a subdir to avoid root dir clutter
- jarFile = 'src/build/gradle-wrapper.jar'
-}
View
108 pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.springframework.samples</groupId>
+ <artifactId>spring-3.1-profiles-xml</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ <build>
+ <sourceDirectory>src/main</sourceDirectory>
+ <testSourceDirectory>src/test</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Tests.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>springsource-milestone</id>
+ <name>Spring Framework Milestone Repository</name>
+ <url>http://maven.springframework.org/milestone</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>3.1.0.M1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.1.0.M1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>3.1.0.M1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
+ </properties>
+</project>
View
57 src/build/admin-tasks.gradle
@@ -0,0 +1,57 @@
+apply plugin: 'maven'
+
+task wrapper(type: Wrapper) {
+ group = 'Admin'
+ description = "Generates gradlew and gradlew.bat bootstrap scripts"
+ gradleVersion = '0.9.2'
+ // place jar file and properties into a subdir to avoid root dir clutter
+ jarFile = 'src/build/gradle-wrapper.jar'
+}
+
+task generatePom {
+ group = 'Admin'
+ description = 'Generates a Maven POM file suitable for use in building the project'
+
+ build.dependsOn generatePom
+
+ doLast() {
+ // customize the pom creation process
+ pom {
+ project {
+ name = project.description
+ properties {
+ setProperty('project.build.sourceEncoding', 'UTF8')
+ }
+ build {
+ plugins {
+ plugin {
+ groupId = 'org.apache.maven.plugins'
+ artifactId = 'maven-compiler-plugin'
+ configuration {
+ source = '1.6'
+ target = '1.6'
+ }
+ }
+ plugin {
+ groupId = 'org.apache.maven.plugins'
+ artifactId = 'maven-surefire-plugin'
+ configuration { includes { include = '**/*Tests.java' } }
+ }
+ }
+ sourceDirectory = 'src/main'
+ testSourceDirectory = 'src/test'
+ resources { resource { directory = 'src/main' } }
+ testResources { testResource { directory = 'src/test' } }
+ }
+ repositories {
+ repository {
+ id = 'springsource-milestone'
+ name = 'Spring Framework Milestone Repository'
+ url = 'http://maven.springframework.org/milestone'
+ snapshots { enabled = false }
+ }
+ }
+ }
+ }.writeTo('pom.xml')
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.