---
title: "maven Multiple sourceDirectory插件"
author: "duooluu"
date: "2009-03-24T00:46:03Z"
tags: []
categories: ["研发管理"]
slug: "maven-multiple-sourcedirectory"
draft: false
lastmod: "2009-03-24T00:51:01Z"
id: 353883
url: "https://duooluu.iteye.com/blog/353883"
---

一个工程里存在多个source directory的时候，但mvn eclipse只支持一个source directory，一执行mvn eclipse:eclipse只会保留一个source directory。找到一个插件可以设置多个source directory

http://mojo.codehaus.org/build-helper-maven-plugin/

使用

```java

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/config/java</source>
                <source>src/main/java</source>
                <source>src/member/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

```