question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Aggregator goal for generating sources

See original GitHub issue

Related to SO 29563593.

I am trying to compile aggregated javadocs for a multimodule Maven project. The parent project has a packaging of pom and it seems like Maven will not run any of the standard goals.

I am proposing to add a goal to lombok-maven-plugin annotated with @aggregator, which would

  • delombok aggregated sources
  • add those to the sourcepath

If everything works out as planned, this could then be processed by the maven-javadoc-plugin.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
awhitfordcommented, Sep 1, 2015

The reason why this isn’t working for you is because you are running javadoc against the original source java, not the resulting java from delombok.

The delombok goal is designed to transform java code from src/main/lombok to target/generated-source/delombok. Then, the other java code found in src/main/java is combined with target/generated-source/delombok to produce the elaborated javadoc.

You have to think of delombok as a source code generator.

By forcing the delombok goal to run against src/main/java (and disabling the addOutputDirectory), the original java source is unchanged, and then javadoc runs only against the original java source. Now I understand why you need to disable addOutputDirectory – otherwise you will get a duplicate class compilation error.

So how can you get what you really want? (Note that Maven has an addCompileSourceRoot method, but not a corresponding removeCompileSourceRoot.) Imagine the following hack:

  1. Override the default <build><sourceDirectory> from src/main/java to be ${project.build.directory}/generated-sources/delombok.
  2. Override the default delombok sourceDirectory from src/main/lombok to be src/main/java, and disable addOutputDirectory (as you have it).

Basically, you will use src/main/java, but Maven will ignore it and instead use target/generated-sources/delombok. The Lombok plugin will transform src/main/java into elaborated code in target/generated-sources/delombok. You had step 2, you were just missing step 1.

Use this hack at your own risk. (My guess is that this may confuse your IDE and some other developers.)

  <build>
    <sourceDirectory>${project.build.directory}/generated-sources/delombok</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok-maven-plugin</artifactId>
        <version>1.16.6.1</version>
        <executions>
          <execution>
            <id>delombok</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>delombok</goal>
            </goals>
            <configuration>
              <addOutputDirectory>false</addOutputDirectory>
              <sourceDirectory>src/main/java</sourceDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
0reactions
eaaltonencommented, May 29, 2015

@awhitford What were your results? Were the Lombok generated methods included in the output Javadoc?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create An Aggregator Website And Why You Should
6 tips for aggregating content effectively · 1. Use credible sources · 2. Add value · 3. Summarize · 4. Give proper credits...
Read more >
Content Aggregator: What You Need to Know and Top Tools ...
The end goal of a content aggregator is to gather and display relevant information related to a specific topic in one place to...
Read more >
Aggregators – Innovation Landscape Brief - IRENA
An aggregator can help in better integration of renewable energy resources by providing both demand- and supply-side flexibility services to the grid. Demand- ......
Read more >
Aggregator - an overview | ScienceDirect Topics
The aggregator is an actor in energy systems, and can be defined as an agent who “offers services to aggregate energy production from...
Read more >
News aggregator - Wikipedia
In computing, a news aggregator, also termed a feed aggregator, feed reader, news reader, RSS reader or simply an aggregator, is client software...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found