GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — addResourcesToClasspath adds src/main/resources to module path · Issue #534 · mojohaus/exec-maven-plugin

addResourcesToClasspath adds src/main/resources to module path #534

New issue
Copy link
New issue
Copy link
Closed
#560
Closed
addResourcesToClasspath adds src/main/resources to module path#534
#560
Copy link
Labels
enhancementNew feature or request

Description

@inaldt
inaldt
opened on Aug 9, 2026
Issue body actions

Given a configuration like this:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run-codegen</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>java</executable>
                    <arguments>
                        <argument>--module-path</argument>
                        <modulepath/>
                        <argument>${codegen.folder}/mypackage/GenerateMyCode.java</argument>
                        <argument>${project.basedir}</argument>
                    </arguments>
                    <longModulepath>false</longModulepath>
                    <classpathScope>provided</classpathScope>
                    <addResourcesToClasspath>true</addResourcesToClasspath>
                    <sourceRoot>${project.build.directory}/generated-sources/myproject</sourceRoot>
                    <useMavenLogger>true</useMavenLogger>
                </configuration>
            </plugin>

...the exec maven plugin adds the src/main/resources folder to the module path. At first I thought that made sense, but I quickly found out that it's actually not very helpful, as the src/main/resources folder typically does not contain a module-info.class file and is also not a jar, and therefor will be ignored by module resolution.

As a workaround, I now added

                        <argument>-classpath</argument>
                        <argument>${project.basedir}/src/main/resources</argument>

...which works. But perhaps it would be good to make this the default behavior, i.e., to always add it to the class path (even when using the module path for everything else).

Tested with exec-maven-plugin 3.6.3.

Activity

  1. slachiewicz
    added
    enhancementNew feature or request
    on Oct 12, 2026
  2. slachiewicz
    closed this as completedin #560on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.