maven 创建Hadoop程序
这里用来将新建的maven project 放入到现有的maven working set 中,这样我们就能看到项目之间的层级关系
选择下面的程序
在父项目中创建公共的pom,在pom中维护项目所需要的各种jar包其中version在properites中指定
在 midules中添加子模块
以下是两个主要的plugin
同dependencyManageMent
<pluginManagement>
<plugins>
<!-- maven project model -->
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.resources.plugin}</version>
</plugin>
</plugins>
</pluginManagement>
设定jdk的版本以及编译版本
<plugins>
<!-- set the jdk version and compile level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins> 子项目中:
设置直系parent
下面设置avro(阿弗罗自动构建命令)
<build>
<plugins>
<!-- maven project model -->
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-avro-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>schema</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>StringPair.avsc</include>
</includes>
<project>
<groupId>donggege.gege</groupId>
</project>
<sourceDirectory>src/main/resources/avro</sourceDirectory>
<outputDirectory>${project.build.main.directory}</outputDirectory>
<testSourceDirectory>src/main/resources/avro</testSourceDirectory>
<testOutputDirectory>${project.build.test.directory}</testOutputDirectory>
</configuration>
</plugin>
</plugins>
</build>