Migrating from Ant to Maven to build the project

master
Yves Blusseau 15 years ago
parent 844d8bbdf3
commit 188beca85b

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
</classpath> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

@ -1,17 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>themoviedbapi</name> <name>themoviedbapi</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> <buildCommand>
<natures> <name>org.maven.ide.eclipse.maven2Builder</name>
<nature>org.eclipse.jdt.core.javanature</nature> <arguments>
</natures> </arguments>
</projectDescription> </buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

@ -0,0 +1,6 @@
#Sat Jan 29 22:13:58 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

@ -0,0 +1,8 @@
#Sat Jan 29 22:13:55 CET 2011
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

@ -1,77 +0,0 @@
<?xml version="1.0"?>
<project name="themoviedbapi" default="dist" basedir=".">
<target name="init">
<property name="project" value="TheMovieDB API" />
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<!-- Get the revision information from SVN -->
<property environment="env" />
<condition property="revision" value="${env.SVN_REVISION}" else="0000">
<isset property="env.SVN_REVISION" />
</condition>
</target>
<target name="clean" depends="init" description="Delete the directories for a clean build">
<delete dir="${build}" />
<delete dir="${dist}" />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
</target>
<target name="version" description="Write out the version file">
<tstamp>
<format property="builddate" pattern="yyyy-MM-dd HH:mm:ss" locale="en"/>
</tstamp>
<!-- Write out the readme information file -->
<echo file="${dist}/${ant.project.name}_version.txt" append="false">${project}${line.separator}</echo>
<echo file="${dist}/${ant.project.name}_version.txt" append="true">Build Date: ${builddate}${line.separator}</echo>
<echo file="${dist}/${ant.project.name}_version.txt" append="true">Revision: r${revision}${line.separator}</echo>
<copy file="${src}/readme.txt" tofile="${dist}/${ant.project.name}_readme.txt" overwrite="true"/>
<manifest file="MANIFEST.MF">
<attribute name="Built-By" value="${user.name}" />
<attribute name="Specification-Title" value="${project}" />
<attribute name="Implementation-Version" value="${revision}" />
<attribute name="Implementation-Title" value="${builddate}" />
</manifest>
</target>
<target name="compile" depends="clean" description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile, version" description="generate the distribution" >
<jar jarfile="${dist}/${ant.project.name}.jar" manifest="MANIFEST.MF">
<!-- Put everything in ${build} into the jar file -->
<fileset dir="${build}">
<include name="**/*.class"/>
</fileset>
<!-- Add files from the ${src} too -->
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
</jar>
<zip basedir="dist" destfile="${dist}/${ant.project.name}_r${revision}.zip" excludes="*.zip" level="9" comment="${project}${line.separator}Build Date: ${builddate}${line.separator}Revision: r${revision}${line.separator}"/>
<delete>
<fileset dir="${dist}">
<exclude name="*.zip"/>
<exclude name="*.jar"/>
</fileset>
</delete>
</target>
</project>

@ -0,0 +1,147 @@
<?xml version="1.0"?>
<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>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>6</version>
</parent>
<groupId>com.moviejukebox</groupId>
<artifactId>themoviedbapi</artifactId>
<version>1.0-SNAPSHOT</version>
<name>The MovieDB API</name>
<issueManagement>
<system>Google Code</system>
<url>http://code.google.com/p/themoviedbapi/issues/list</url>
</issueManagement>
<ciManagement>
<system>Hudson CI</system>
<url>http://mediadeveloper.org:8080/job/themoviedbapi/</url>
</ciManagement>
<scm>
<connection>scm:svn:http://themoviedbapi.googlecode.com/svn/trunk/themoviedbapi</connection>
<developerConnection>scm:svn:https://themoviedbapi.googlecode.com/svn/trunk/themoviedbapi</developerConnection>
<tag>HEAD</tag>
<url>http://code.google.com/p/themoviedbapi/source/browse/trunk/themoviedbapi</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0-beta-4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<revisionOnScmFailure>0000</revisionOnScmFailure>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<failOnError>true</failOnError>
<verbose>true</verbose>
<!-- excludes><exclude>**/*</exclude></excludes -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${buildNumber}</Implementation-Version>
<Implementation-Title>${timestamp}</Implementation-Title>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- To skip tests by default -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
</plugins>
<finalName>${artifactId}-${project.version}-r${buildNumber}</finalName>
</build>
</project>
Loading…
Cancel
Save