!!! Listings aus dem Artikel "Das Beste zweier Welten"
!!! von Kalr Banke in iX 9/2011, S. 78

!!! Listing 1: pom.xml (Maven)

!!! pom.xml -- bitte kursiv

<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>
  <groupId>com.iternum.demo</groupId>
  <artifactId>SimpleAccountInfo</artifactId>
  <packaging>jar</packaging>
  <version>1.0.0</version>
  <name>SimpleAccountInfo</name>
  <url>http://maven.apache.org</url>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.5</source>
					<target>1.5</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
  
  <dependencies>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

!!! Listing 2:

C:\Users\bankkar\workspace\SimpleAccountService\src\main\java\com\iternum\demo\account\service\AccountService.java:17: cannot find symbol
symbol  : variable LogFactory
location: class com.iternum.demo.account.service.AccountService
        private Log log = LogFactory.getLog(AccountService.class);
                     ^
4 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
Cause: Compile failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 3.524 secs


!!! Listing 22: 

apply plugin: 'java'
apply plugin: 'maven'

project.group="com.iternum"
project.artifactId="SimpleAccountBean"
project.version="1.0.0"

repositories {
    mavenCentral name: "jboss", urls: "http://repository.jboss.org/nexus/content/groups/public-jboss/"
}

dependencies {
    compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
    testCompile group: 'junit', name: 'junit', version: '3.8.1'
}

sourceSets {
    main {
        java {
            srcDir 'build/generated/java'
        }
        resources {
            srcDir 'build/generated/resources'
        }
    }
}

task generateSources(type: Copy) {
	
    from 'src/main'
    into project.buildDir.toString() + '/generated/java'
	include '**/*.template'
	expand(project.properties)
    // Use a closure to map the file name
    rename { String fileName ->
        fileName.replace('.template', '.java')
    }
}

compileJava.dependsOn generateSources