hacky code in class MavenProject causing problems in multi-module build

View: New views
1 Messages — Rating Filter:   Alert me  

hacky code in class MavenProject causing problems in multi-module build

by torsten.reinhard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have the following module-tree:

src\gide-parent
src\parent\ui-parent

src\common\ui
        \services
src\gdcams\ui
        \services
src\kvkams\ui
        \services

In parent/ui-parent I have these modules:

        <modules>
                <!-- TODO wird ggf. separater Build gebaut -->
                <module>../../common/gide-tools</module>
                <module>../../common/ui/gide-common-ui-generator</module>
 
                <!-- TODO wird ggf. separater Build gebaut -->
                <module>../../common/services</module>
                <module>../../gdcams/services</module>
                <module>../../kvkams/services</module>

                <!-- Aggregator POMs ! -->
                <module>../../common/ui</module>
                <module>../../gdcams/ui</module>
                <module>../../kvkams/ui</module>
                <module>../../kvkams/ui/build-kvkams-ui-war</module>
        </modules>

When executing a goal of a maven-plugin, I get the following stack:

Thread [main] (Suspended (breakpoint at line 337 in MavenProject))
        MavenProject.getModulePathAdjustment(MavenProject) line: 337
        DefaultMavenProjectBuilder.buildInternal(String, Model,
ProjectBuilderConfiguration, List, File, boolean) line: 844
        DefaultMavenProjectBuilder.buildFromSourceFileInternal(File,
ProjectBuilderConfiguration, boolean) line: 506
        DefaultMavenProjectBuilder.build(File,
ProjectBuilderConfiguration) line: 198
        DefaultMaven.getProject(File, MavenExecutionRequest) line: 583
        DefaultMaven.collectProjects(List, MavenExecutionRequest, boolean)
line: 461
        DefaultMaven.getProjects(MavenExecutionRequest) line: 365
        DefaultMaven.doExecute(MavenExecutionRequest, EventDispatcher)
line: 292
        DefaultMaven.execute(MavenExecutionRequest) line: 129
        MavenCli.main(String[], ClassWorld) line: 287
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
not available [native method]
        NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
        Method.invoke(Object, Object...) line: 585
        Launcher.launchEnhanced(String[]) line: 315
        Launcher.launch(String[]) line: 255
        Launcher.mainWithExitCode(String[]) line: 430
        Launcher.main(String[]) line: 375

while iterating over all modules, the moduleAdjustments HashMap gets
corrupted, because the moduleName is extracted as substring from the
"modulePath".
So in my case, the moduleName "services" is added three times to the
HashMap, overriding the last entry and adjustment !

...
moduleAdjustments.put( moduleName, adjustment );
...


I know that the root cause of the problem is the naming of my directories
- they don´t match the artifactId in each case.
But maybe there´s a workaround or fix, that prevents me from renaming my
whole directory structure?

Thanx, Torsten

P.S.: Should I file a bug for that issue ?