<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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.github.mcpat.libxjava</groupId>
		<artifactId>libxjava-parent</artifactId>
		<relativePath>../pom.xml</relativePath>
		<version>0.2</version>
	</parent>
	<artifactId>libxjava-cdc</artifactId>

	<packaging>jar</packaging>
	<name>Lib-Cross-Java CDC</name>
	<description>Lib-Cross-Java for the Connected Device Configuration v1.1.2</description>

	<properties>
		<libxjava-license-dir>${basedir}/..</libxjava-license-dir>
		<libxjava-class-version>1.3</libxjava-class-version>
		<libxjava-boot-classpath>${cldc-jar}</libxjava-boot-classpath>
		<libxjava-boot-classpath>${java.home}/lib/rt.jar</libxjava-boot-classpath>
		<libxjava-cldc-shared>${basedir}/../libxjava-cldc/src/shared/java</libxjava-cldc-shared>
		<libxjava-api-link>${clc-api-link}</libxjava-api-link>
	</properties>

	<dependencies>
		<dependency>
			<groupId>com.github.mcpat.apistubs</groupId>
			<artifactId>cdc-1.1.2-stub</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
	</dependencies>
	
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<configuration>
						<bootclasspath>${libxjava-boot-classpath}</bootclasspath>
						<detectJavaApiLink>false</detectJavaApiLink>
						<links>
							<link>http://download.oracle.com/javame/config/cdc/ref-impl/cdc1.1.2/jsr218</link>
						</links>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>filter-sources</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${libxjava-module-sources}</outputDirectory>
							<resources>
								<resource>
									<directory>${basedir}/src/shared/java</directory>
									<filtering>true</filtering>
								</resource>
								<resource>
									<directory>${libxjava-cldc-shared}</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>process-switches</id>
						<phase>process-sources</phase>
						<configuration>
							<target>
								<echo>processing switches in source files...</echo>
								<property name="ant.regexp.regexpimpl" value="org.apache.tools.ant.util.regexp.JakartaOroRegexp"/>
								<replaceregexp byline="true" flags="g" match="/\*\[CDC(.+?)CDC\]\*/" replace="\1">
									<fileset dir="${libxjava-module-sources}"/>
								</replaceregexp>
								<replaceregexp byline="true" flags="g" match="/\*\[.+?\]\*/" replace="">
									<fileset dir="${libxjava-module-sources}"/>
								</replaceregexp>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>clirr-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
	
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<bootclasspath>${libxjava-boot-classpath}</bootclasspath>
					<detectJavaApiLink>false</detectJavaApiLink>
					<links>
						<link>http://download.oracle.com/javame/config/cdc/ref-impl/cdc1.1.2/jsr218</link>
					</links>
				</configuration>
			</plugin>
		</plugins>
	</reporting>
	
	<profiles>
		<profile>
			<!-- create metadata with 'mvn -Peclipse' -->
			<id>eclipse</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			
			<build>
				<defaultGoal>generate-sources</defaultGoal>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>add-source</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>add-source</goal>
								</goals>
								<configuration>
									<sources>
										<source>${project.basedir}/src/shared/java</source>
									</sources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-eclipse-plugin</artifactId>
						<configuration>
							<linkedResources>
								<linkedResource>
									<name>libxjava-cldc-shared</name>
									<type>2</type>
									<location>${libxjava-cldc-shared}</location>
								</linkedResource>
							</linkedResources>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>	
