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

Improve/Fix documentation to correctly define aspectj-maven-plugin in pom.xml for Powertool for v2 #1787

Open
1 task done
Vadym79 opened this issue Mar 4, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation v2 Version 2

Comments

@Vadym79
Copy link

Vadym79 commented Mar 4, 2025

What were you searching in the docs?

In the documentation page for v2 aspectj-maven-plugin is currently defined like this

    <plugin>
         <groupId>dev.aspectj</groupId>
         <artifactId>aspectj-maven-plugin</artifactId>
         <version>1.13.1</version>
         <configuration>
             <source>11</source> <!-- or higher -->
             <target>11</target> <!-- or higher -->
             <complianceLevel>11</complianceLevel> <!-- or higher -->
             <aspectLibraries>
                 <aspectLibrary>
                     <groupId>software.amazon.lambda</groupId>
                     <artifactId>powertools-tracing</artifactId>
                 </aspectLibrary>
                 <aspectLibrary>
                     <groupId>software.amazon.lambda</groupId>
                     <artifactId>powertools-logging</artifactId>
                 </aspectLibrary>
                 <aspectLibrary>
                     <groupId>software.amazon.lambda</groupId>
                     <artifactId>powertools-metrics</artifactId>
                 </aspectLibrary>
             </aspectLibraries>
         </configuration>
         <executions>
             <execution>
                 <goals>
                     <goal>compile</goal>
                 </goals>
             </execution>
         </executions>
    </plugin>

The same is true for other pages, like for logging, tracing and metrics
Unfortunately it misses dependency to aspectjtools (without it, it doesn't work), see the official page. Also please update source, target and compliance level to use Java 21 by default.

Is this related to an existing documentation section?

https://docs.powertools.aws.dev/lambda/java/preview/

How can we improve?

    <plugin>
         <groupId>dev.aspectj</groupId>
         <artifactId>aspectj-maven-plugin</artifactId>
         <version>1.14</version>
         <dependencies>
      		<dependency>
        		<groupId>org.aspectj</groupId>
        		<artifactId>aspectjtools</artifactId>
        		<!-- AspectJ compiler version, in sync with runtime -->
        		<version>${aspectj.version}</version>
      		</dependency>
    	</dependencies>
         <configuration>
             <source>21</source>
             <target>21</target>
             <complianceLevel>21</complianceLevel>
             <aspectLibraries>
                 <aspectLibrary>
                     <groupId>software.amazon.lambda</groupId>
                     <artifactId>powertools-tracing</artifactId>
                 </aspectLibrary>
                 <aspectLibrary> 
                     <groupId>software.amazon.lambda</groupId>
                     <artifactId>powertools-logging</artifactId>
                 </aspectLibrary>
                 <aspectLibrary>
                     <groupId>software.amazon.lambda</groupId>
                     <artifactId>powertools-metrics</artifactId>
                 </aspectLibrary>
             </aspectLibraries>
         </configuration>
         <executions>
             <execution>
                 <goals>
                     <goal>compile</goal>
                 </goals>
             </execution>
         </executions>
    </plugin>

Got a suggestion in mind?

add dependency to aspectjtools

         <dependencies>
      		<dependency>
        		<groupId>org.aspectj</groupId>
        		<artifactId>aspectjtools</artifactId>
        		<!-- AspectJ compiler version, in sync with runtime -->
        		<version>${aspectj.version}</version>
      		</dependency>
        </dependencies>

and set source, target and compliance level to 21 in the configuration section of the aspectj-maven-plugin like in my working example

Acknowledgment

  • I understand the final update might be different from my proposed suggestion, or refused.
@phipag
Copy link
Contributor

phipag commented Mar 6, 2025

Hey @Vadym79, thanks for opening this issue and the other ones.

I tested this today and came to the same conclusion that aspectjtools is missing.

I think it is also a good idea to default documentation examples to Java 21 to steer users towards using new Java versions. Although we should still make clear what the minimum supported version is.

Currently, it is planned to keep Java11 as the minimum supported version in Powertools which was decided here: #1523 (comment).

@phipag phipag added v2 Version 2 and removed triage labels Mar 6, 2025
@phipag phipag moved this from Triage to Backlog in Powertools for AWS Lambda (Java) Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation v2 Version 2
Projects
Status: Backlog
Development

No branches or pull requests

2 participants