开发者

Maven plugin dependency isn't added to classpath in multi-module scenario

i have an multi-module maven project with the following structure:

  • Root
    • sub-module1
    • sub-module2
    • sub-module3

Now i created an maven plugin that should generate sources. I've added the plugin to the pom of sub-module2. This plugin configuration has an dependency to "sub-module1". So if i call now "mvn clean compile" on "sub-module2" the plugin generates me sources by information of "sub-module1". But if i call now "mvn clean compile" on the Root project, the sources aren't generated. The plugin is executed but it seams like that the plugin dependency to th sub-module 1 isn't added to the classpath :/ ... has anyone an idea where is the problem? Is it a maven bug?

EDIT:

It's an plugin i wrote myself ... its for generating flex source files by some xml files of sub-module1. The plugin runs in the "generate-sources" phase. This is how the plugin is configured in the pom:

<plugin>
    <groupId>xxx</groupId>
    <artifactId>code-generator-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <!-- Generate by default only classes for our metadata -->
        <catalogs>
            <catalog>/xxx/.*</catalog>
        </catalogs>
        <!-- Generated files will be placed directly in the source folder -->
        <outputFolder>src/main/flex</outputFolder>
    </configuration>
    <dependencies>
        <!-- Don't forgot this dependency to the API project -->
        <dependency>
            <groupId>xxx</groupId>
            <artifactId>api</artifactId>
            <!-- We have to put version here because dependencyManagement -->
            <!-- doesn't work for plugin dependencies -->
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</plugin>

This is the plugin d开发者_如何学Cefined in the pom of sub-module2 ... the dependency to the artifactId "api" is the "sub-module1" i described on top of my post


Answered in comments:

Oh my god ... i waste now 3 hours to find the problem... Everything works fine. The problem was the working directory / and a relativ path. If i call mvn clean compile on the sub-module everything was generated on the right place ... if i call it on the root module the sources where generated int "Root/src/main/flex.." instead of "Root/sub-module2/src/main/flex...." ... sorry for wasting your time :/ ... i have to add the maven base directory to place the files in the right place... – Michael Jul 14 '11 at 13:44

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜