我正在尝试使用jdk1.3和maven 1.0.2构建一个jar文件。这是旧的Java代码,这意味着我无法使用更新版本的java。以下是我目前正在使用的pom文件:
<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.sample.team</groupId>
<artifactId>Base</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Base</name>
<url>http://maven.apache.org</url>
<properties>
<jdk.version>1.3</jdk.version>
<!--jodatime.version>2.5</jodatime.version-->
<junit.version>4.10</junit.version>
<log4j.version>1.2.16</log4j.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<!--dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.2.16</version>
</dependency-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<build>
<finalName>Base</finalName>
<resources>
<resource>
<directory>nebModule</directory>
<filtering>true</filtering>
<includes>
<include>com\abc\ebill\base\**\*.class</include>
<include>com\abc\team\common\domain\**\*.class</include>
</includes>
</resource>
</resources>
<plugins>
<!-- download source code in Eclipse, best practice -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<!-- Set a compiler level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<!-- Make this jar executable -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/log4j.properties</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--mainClass>com.mkyong.core.utils.App</mainClass-->
<classpathPrefix>dependency-jars/</classpathPrefix>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
<includes>
<include>**\com\abc\ebill\base\**\*.class</include>
<include>**\com\abc\team\common\domain\**\*.class</include>
</includes>
</configuration>
</plugin>
<!-- Copy project dependency -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- exclude junit, we need runtime dependency only -->
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/extra-resources</outputDirectory>
<resources>
<resource>
<directory>nebModule</directory>
<filtering>true</filtering>
<includes>
<include>com\abc\ebill\base\**\*.java</include>
<include>com\abc\team\common\domain\**\*.java</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
调用:maven -X -p pom.xml jar:jar时,使用名为Base的jar和三个文件夹创建目标工作区:classes,test-classes,test-reports。文件夹和jar是空的。如何将.java文件编译成以下类:com \ abc \ ebill \ base ***。java和com \ abc \ team \ common \ domain ***。java并将它们添加到jar中?