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

Can't configure nested configuration properties #158

Open
maxonfjvipon opened this issue Mar 16, 2025 · 15 comments
Open

Can't configure nested configuration properties #158

maxonfjvipon opened this issue Mar 16, 2025 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@maxonfjvipon
Copy link

maxonfjvipon commented Mar 16, 2025

I want to build the next structure in pom.xml with Farea

<build>
  <artifactId>maven-jar-plugin</artifactId>
  <version>3.4.2</version>
  <configuration>
    <archive>
      <manifest>
        <addClasspath>true</addClasspath>
        <mainClass>org.eolang.Main</mainClass>
      </manifest>
    </archive>
  </configuration>
</build>

Here you may see configuration with nested elements <archive><manifest><addClasspath>.... It seems it's not possible to build such structure with Farea. The only available API after f.build().plugins().append().configuration() is .set() which allows to set property only on the first level.

@yegor256
Copy link
Owner

@maxonfjvipon did you try it with .set(HashMap)?

@maxonfjvipon
Copy link
Author

@yegor256 I tried this:

f.build()
    .plugins()
    .append(
        "maven-jar-plugin",
        "3.4.2"
    )
    .configuration()
    .set(
        "archive", Map.of(
            "manifest", Map.of(
                "addClasspath", "true",
                "mainClass", "org.eolang.Main"
            )
        )
    );

I got such xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.4.2</version>
    <configuration>
       <archive>
          <manifest>{mainClass=org.eolang.Main, addClasspath=true}</manifest>
       </archive>
    </configuration>
 </plugin>

Then I tried this:

f.build()
  .plugins()
  .append(
      "maven-jar-plugin",
      "3.4.2"
  )
  .configuration()
  .set(
      "archive", Map.of(
          "manifest", Map.of(
              Map.of("addClasspath", "true"),
              Map.of("mainClass", "org.eolang.Main")
          )
      )
  );

And got this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.4.2</version>
    <configuration>
       <archive>
          <manifest>{{addClasspath=true}={mainClass=org.eolang.Main}}</manifest>
       </archive>
    </configuration>
 </plugin>

Both are wrong. What's right way to do it?

@yegor256 yegor256 self-assigned this Mar 17, 2025
@yegor256 yegor256 added the bug Something isn't working label Mar 17, 2025
yegor256 added a commit that referenced this issue Mar 17, 2025
yegor256 added a commit that referenced this issue Mar 17, 2025
yegor256 added a commit that referenced this issue Mar 17, 2025
@yegor256
Copy link
Owner

@rultor release, tag is 0.15.1

@rultor
Copy link
Collaborator

rultor commented Mar 17, 2025

@rultor release, tag is 0.15.1

@yegor256 OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Mar 17, 2025

@rultor release, tag is 0.15.1

@yegor256 Done! FYI, the full log is here (took me 22min).

yegor256 added a commit that referenced this issue Mar 17, 2025
@yegor256
Copy link
Owner

@rultor release, tag is 0.15.2

@rultor
Copy link
Collaborator

rultor commented Mar 17, 2025

@rultor release, tag is 0.15.2

@yegor256 OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Mar 17, 2025

@rultor release, tag is 0.15.2

@yegor256 Done! FYI, the full log is here (took me 19min).

@yegor256
Copy link
Owner

@maxonfjvipon try 0.15.2, this should work:

    .set(
        "archive", Map.of(
            "manifest", Map.of(
                "addClasspath", "true",
                "mainClass", "org.eolang.Main"
            )
        )
    );

@maxonfjvipon
Copy link
Author

@yegor256 I still get this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.4.2</version>
    <configuration>
       <archive>
          <manifest>{mainClass=org.eolang.Main, addClasspath=true}</manifest>
       </archive>
    </configuration>
 </plugin>

yegor256 added a commit that referenced this issue Mar 17, 2025
@yegor256
Copy link
Owner

@rultor release, tag is 0.15.3

@yegor256
Copy link
Owner

@maxonfjvipon my mistake, please try 0.15.3 (when it's released)

@rultor
Copy link
Collaborator

rultor commented Mar 17, 2025

@rultor release, tag is 0.15.3

@yegor256 OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Mar 17, 2025

@rultor release, tag is 0.15.3

@yegor256 Done! FYI, the full log is here (took me 20min).

@yegor256
Copy link
Owner

@maxonfjvipon please, try 0.15.3, should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants