Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configuration for Maven #84

Open
xezzon opened this issue Dec 15, 2024 · 2 comments
Open

Support configuration for Maven #84

xezzon opened this issue Dec 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@xezzon
Copy link

xezzon commented Dec 15, 2024

Summary(关于这个pr的描述,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

  1. Configure each configuration in pom.xml. And you can get the IDE completion that META-INF/maven/plugin.xml should contain a description of these configurations.
  2. If configFile is specified, get the configuration from configFile, otherwise get the configuration from pom.xml.
  1. 能够在 pom.xml 中完成所有配置。META-INF/maven/plugin.xml 应包含这些配置的描述,这样 IDE 能够进行补全。
  2. 如果指定了 configFile,则从 configFile 获取配置,否则从 pom.xml 获取配置。

Basic example(pr的用例,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

<project>
  <build>
    <plugins>
      <plugin>
        <groupId>com.ly.smart-doc</groupId>
        <artifactId>smart-doc-maven-plugin</artifactId>
        <configuration>
          <outDir>${project.build.outputDirectory}/public/v3/api-docs</outDir>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>openapi</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

image

Motivation(提出这个pr目的,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

  1. Configuration in pom.xml can be inherited , so you do not need to copy a json file for each service , you want to modify a configuration item , you do not need to modify all the json configuration file .
  2. You can get IDE completion.
  3. You can use Maven properties in your configuration.
  1. pom.xml 的配置可以继承,这样就不需要给每一个 service 都拷贝一个 json 文件,想要修改某个配置项时,也不需要修改所有的 json 配置文件了。
  2. 可以获得IDE补全。
  3. 可以在配置中使用 Maven property。
@xezzon xezzon added the enhancement New feature or request label Dec 15, 2024
@shalousun
Copy link
Collaborator

shalousun commented Dec 16, 2024

@xezzon We initially considered the issue of XML configuration being verbose, especially with the extensive configuration required for smart-doc and some complex structural configurations. Additionally, many community users have multiple environment configurations. Therefore, our future direction is to support YAML format for configuration.

For YAML writing assistance, the community can draw inspiration from the design of plugins like Spring Assistant and develop an IDEA plugin specifically for this purpose. This will provide better support and a more streamlined experience for users working with YAML configurations.

@xezzon
Copy link
Author

xezzon commented Dec 17, 2024

For YAML writing assistance, JSON Schema does the trick nicely.

However YAML is not helpful for the other two requirements - configuring inheritance and using Maven properties. Configuration duplication is worse than verbose XML.

multiple environment configurations I don't understand what is being referred to, and whether Maven profiles would help with the problem.

对于 YAML 的补全,JSON Schema 就可以很好的完成。
然而 YAML 对于另外两项需求——配置继承和使用Maven property——并无帮助。相比于 XML 冗长的配置,重复的配置更要命。
多环境配置我不理解指的是什么,Maven profiles是否有助于解决问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants