我通过它在 Java8 项目中的插件使用 AspectJ,在我的 pom.xml 文件中使用此配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<Xlint>warning</Xlint>
<XaddSerialVersionUID>true</XaddSerialVersionUID>
<encoding>UTF-8</encoding>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
<warn>constructorName,packageDefaultMethod,deprecation,maskedCatchBlocks,unusedLocals,unusedArguments,unusedImports,all</warn>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies>
</plugin>
我收到一些警告,如下所示:
[WARNING] Unnecessary @SuppressWarnings("unused")
[WARNING] Non-externalized string literal; it should be followed by //$NON-NLS-<n>$
[WARNING] The import org.acmsl.queryj.metadata.DecoratorFactory is never used
[WARNING] The method buildMetadataManagerKey() from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] The method buildCustomSqlProviderKey() from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] Non-externalized string literal; it should be followed by //$NON-NLS-<n>$
[WARNING] Non-externalized string literal; it should be followed by //$NON-NLS-<n>$
[WARNING] The method retrieveHeaderFromFile(QueryJCommand, FileUtils) from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] The method buildBasePackageNameKey() from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] The method buildRepositoryNameKey() from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] The method buildJndiLocationKey() from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] The method getBooleanValue(QueryJCommand, String) from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] The expression of type Boolean is unboxed into boolean
[WARNING] The method toCsv(List<Attribute<String>>) from the type AbstractQueryJTemplateContext can potentially be declared as static
[WARNING] Non-externalized string literal; it should be followed by //$NON-NLS-<n>$
[WARNING] Empty block should be documented
[WARNING] Empty block should be documented
[WARNING] Redundant specification of type arguments <String, STGroup>
[WARNING] Unnecessary semicolon
[WARNING] The method retrieveUncachedGroup(String, List<String>, STErrorListener, Charset) from the type STUtils can potentially be declared as static
[WARNING] The method PerCommentTabIsaVisitor.visitTabIsa(PerCommentParser.TabIsaContext) is overriding a method without making a super invocation
[WARNING] Non-externalized string literal; it should be followed by //$NON-NLS-<n>$
[WARNING] Unnecessary @SuppressWarnings("unused")
[WARNING] Unnecessary @SuppressWarnings("unused")
[WARNING] The method AbstractBasePerCustomResultTemplate<C>.buildHeader() is overriding a method without making a super invocation
但是它们没有用,因为缺少文件/行信息。我认为我没有使用任何关于 Maven 日志记录格式的特殊自定义,这可能会吞噬我感兴趣的上下文。这是默认的 ajc 日志记录吗?可以定制吗?