smartics / smartics-jboss-modules-maven-plugin

Generates an archive of modules based on information in a POM to be copied to an JBoss 7 installation.
https://www.smartics.eu/confluence/display/SJBMMP/
Other
13 stars 10 forks source link

Duplicated module dependencies in generated module.xml file #21

Closed jamesnetherton closed 9 years ago

jamesnetherton commented 9 years ago

Consider a module definition like the following:

<modules xmlns="http://smartics.de/ns/jboss-modules-descriptor/1">
    <module name="ognl">
        <match>
            <includes>
                <include>
                    <groupId>ognl</groupId>
                    <artifactId>ognl</artifactId>
                </include>
            </includes>
        </match>
        <apply-to-dependencies>
            <dependencies>
                <match>
                    <includes>
                        <include>javassist</include>
                    </includes>
                </match>
                <apply>
                    <export>true</export>
                </apply>
            </dependencies>
        </apply-to-dependencies>
        <apply-to-module>
            <dependencies>
                <module name="javassist"/>
            </dependencies>
        </apply-to-module>
    </module>
</modules>

Ideally this will generate a module with the javassist dependency with export="true". What actually happens is:

<module xmlns="urn:jboss:module:1.1" name="ognl">
  <resources>
    <resource-root path="ognl-3.0.8.jar" />
  </resources>
  <dependencies>
    <module name="javassist" />
    <module name="javassist" export="true" />
  </dependencies>
</module>

I guess the plugin has already worked out that javassist is a dependency for ognl and is not expecting the user to define this for themselves.

I know that there are simple ways of avoiding this sort of thing, but allowing users to explicitly declare the dependencies for each module within their definitions should be acceptable IMO.

jamesnetherton commented 9 years ago

Raised pull request #22 for this. The solution I decided upon in the end was to make static dependencies take precedence over those that are resolved by the plugin.