Skip to content

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

Closed
@Vadym79

Description

@Vadym79

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.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationv2Version 2

Type

No type

Projects

Status

Working on it

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions