2
我有一个Maven multimodule项目,然后我想将其中一个模块的源代码打包成jar,并将其添加到war中(相同模块或另一个) INF/lib路径。如何在Maven build war中包含jar源代码
于是,我试图使用Maven源插件,像这样:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
然后将其添加为正常的依赖,就像这样:
<dependency>
<groupId>myModuleName</groupId>
<artifactId>myArtifactName</artifactId>
<version>1.0</version>
</dependency>
问题是,当我运行用简单的命令行建立
MVN全新安装
我有错误信息,他无法找到我的工件与源代码。看起来Maven首先查找依赖关系,然后再构建它。
如何正确配置它?
你想直接在lib文件夹中添加类?这不是传统。 – davidxxx
我想打包jar中的类并将其附加到WEB-INF/lib文件夹内的war中。我有一些理由要这样做。 – Andrew
您的需求是传统的。它应该没有额外的任务。 你可以显示你的战争的pom.xml,模块的pom父和所有的堆栈跟踪吗? – davidxxx