Как заставить aspectj-maven-плагин включать имя файла и номер строки в предупреждения

#java #maven #maven-3 #aspectj #aspectj-maven-plugin

#java #maven #maven-3 #aspectj #aspectj-maven-plugin

Вопрос:

Я использую AspectJ через его плагин в проекте Java8, с этой конфигурацией в моем 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 по умолчанию? Можно ли его настроить?

Комментарии:

1. Пожалуйста, примите и поддержите мой ответ, я даже создал для вас заявку и убедился, что проблема в плагине решена.

Ответ №1:

Я думаю, что это недостаток плагина AspectJ Maven, который необходимо устранить. Я только что создал для этого тикет. Пожалуйста, посмотрите это, чтобы быть в курсе прогресса.

Обновление: проблема была исправлена в плагине AspectJ Maven версии 1.7, который был выпущен 2014-09-14.