0
votes

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 defined in the pom of sub-module2 ... the dependency to the artifactId "api" is the "sub-module1" i described on top of my post

1
Can you show the pom you are using? What kind of Plugin are you using? In which life-cycle phase did configured the plugin?khmarbaise
See original question, i've edit itMichael
Well, unless we see some actual Java code, it would be rather hard guess what's going on. Could you post your POM-s (in a more detailed form)?carlspring
In which phase does your plugin beeing run? Furthermore to generate code into the src folder is not the best idea...usually the target folder is the best location for this...Why do you need this dependency you are giving in the configuration of your plugin? Haven't you defined the dependency in the pom of the plugin itself ?khmarbaise
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

1 Answers

0
votes

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