在我的POM我有这种依赖性Maven exec插件不能依赖提供的依赖性吗?
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>0.10.0-RC1</version>
<scope>provided</scope>
</dependency>
</dependencies>
现在我想用这个在Maven Exec插件这样的:
<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>
但每次我执行exec:exec
时间,我得到一个“ java.lang.NoClassDefFoundError:lombok/core/Main“错误。一些测试表明,这是因为在所提供的范围内声明了依赖关系
为什么exec插件不能使用提供的依赖关系?其次,有没有办法让exec插件使用该依赖关系而不更改依赖范围?
这个问题问得在lombok-maven-plugin更新至0.10.0之前询问。请参阅https://github.com/awhitford/lombok.maven/issues/2 – TheLQ