使用Maven创建多个JAR包而不使用配置文件。

huangapple go评论60阅读模式
英文:

Creating multiple jars using maven without using profiles configuration

问题

以下是翻译好的部分:

我有一个使用标准结构创建的Maven项目,还有一个额外的源代码文件夹。项目结构如下所示:

- my_project
    - src/main/java
    - src/main/resources/
    - src/test/java
    - src/test/resources
    - <my_source_folder>

现在我想使用单个Maven目标从项目中创建两个JAR包:

  1. main.jar(不包括my_source_folder)。
  2. my.jar(包括my_source_folder,但不包括src/main/java)。

更新:

我想要实现的用例如下:

我想从项目中创建两个JAR包 - 一个精简JAR包和一个实现JAR包。

  1. 精简JAR包 包含API/接口以及一些轻量级的精简类。
  2. 实现JAR包 包含API/接口的实际实现。

是否有人可以建议一种更好的方法来解决这个问题呢?

英文:

I have a maven project created with standard structure and one addtional source folder. The project structure is as below.

- my_project
    - src/main/java
    - src/main/resources/
    - src/test/java
    - src/test/resources
    - &lt;my_source_folder&gt;

Now I want to create two jars from my project using single maven goal-

  1. main.jar (which excludes my_source_folder).
  2. my.jar (which includes my_source_folder and excludes src/main/java)

Update:

The use case for which I want to do this is as below :

I want to create two jars - a slim jar and an implementation jar from a project.

  1. The slim jar which contains apis/interfaces and some lightweight slim classes
  2. The impl jar which contains actual implementations of apis/interfaces.

Can anyone please suggest what approach could be better to address this?

答案1

得分: 1

创建多模块项目中的两个单独模块。

或者,创建两个单独的项目。

英文:

Create two separate modules in a multi-module project.

Alternatively, create two separate projects.

huangapple
  • 本文由 发表于 2020年4月9日 17:40:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/61118183.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定