mojohaus / mojohaus/exec-maven-plugin

includeProjectDependencies is false by default

Open
#138 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
191
Forks
111
Avg merge
1d 21h
Merged PRs (30d)
4

Description

I was getting java.lang.ClassNotFoundException for a class in the same Maven project as the plugin is running against. This despite the fact that the class was available in target/classes.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>java</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <mainClass>mypackage.MyClass</mainClass>
    </configuration>
</plugin>

This failed until I added <includeProjectDependencies>true</includeProjectDependencies>.

This shouldn't be necessary as https://github.com/mojohaus/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java#L105 says that it's true by default and so does the generated documentation at https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#includeProjectDependencies.

$ mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)
Maven home: /Applications/ApacheGroup/Maven-3.6.1
Java version: 1.8.0_202, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre
Default locale: en_CH, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ExecJavaMojo.java around the mentioned includeProjectDependencies default and compare it with the generated java-mojo.html documentation. Reproduce the Maven configuration using exec-maven-plugin 1.6.0 and verify whether project classes are available without explicitly enabling the option. Done means the documented default and actual behavior agree, with the reported ClassNotFoundException resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.