Skip to content

[REQ] [kotlin-spirng, java-spring] Attach sources to library style outputs (when interfaceOnly=true) #15659

Closed
@zaenk

Description

@zaenk

Is your feature request related to a problem? Please describe.

This is a minor quality of life improvement.

I'm always using interfaceOnly flag, running the generated code through some formatter with post process file, package it up as a jar and using this as a dependency.

What's frustrating is that IDEs go to definition would show decompiled class files. This is hard to understand for koltin, but even for java if we are looking at an API method with many request parameters.

I'm interested in the maintainers and the community's feedback, it this is something that fits the scope of these generators. If it fits I am open for contributing this.

Describe the solution you'd like

For maven builds add attach sources build plugin. I've been using this as a custom template override for some time

### pom.mustache
                    </dependency>
                </dependencies>
-            </plugin>
+            </plugin>{{^interfaceOnly}}
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>{{/interfaceOnly}}
        </plugins>
    </build>
    <dependencies>

Describe alternatives you've considered

Instead of piggybacking this on the interfaceOnly option, this might be implemented as a separate config parameter.

Additional context

I've already described a scenario when this is useful in another issue #15658

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions