In my POM I have this dependency
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>0.10.0-RC1</version>
<scope>provided</scope>
</dependency>
</dependencies>
Now I'm trying to use this in the Maven exec plugin like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>delombok-source</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath>
<dependency>org.projectlombok:lombok</dependency>
</classpath>
<argument>lombok.core.Main</argument>
<argument>delombok</argument>
<argument>src/main/java</argument>
<argument>-d</argument>
<argument>target/src-delomboked</argument>
</arguments>
</configuration>
</plugin>
But every time I execute exec:exec
, I get a "java.lang.NoClassDefFoundError: lombok/core/Main" error. Some testing showed that this is because the dependency is declared in the provided scope
Why can't the exec plugin use provided dependencies? Second, is there any way for the exec plugin to use that dependency without changing the dependency scope?