2016-08-17 5 views
1

Я пытаюсь скомпилировать сгенерированный Spring проект Maven в Eclipse с помощью maven-eclipse-plugin.Ошибка AJC при отсутствии компиляции в Eclipse

Maven выдает следующее сообщение об ошибке во время compile:

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.8:test-compile (default) on project kkos01: AJC compiler errors: 
[ERROR] error no sources specified 
[ERROR] abort AspectJ Compiler 1.8.0 
[ERROR] 
[ERROR] Usage: <options> <source file | @argfile>.. 

Кажется, что так или иначе maven-eclipse-plugin не передает исходные файлы ajc.

Примечание: в наибольшей степени Аспекты генерируется spring-roo.

Вот мой pom.xml:

<project> 
    <properties> 
     <aspectj.version>1.8.0</aspectj.version> 
     <java.version>1.8</java.version> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 
... 
    <build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.4</version> 
      <configuration> 
       <source>${java.version}</source> 
       <target>${java.version}</target> 
       <complianceLevel>${java.version}</complianceLevel> 
       <encoding>${project.build.sourceEncoding}</encoding> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>aspectj-maven-plugin</artifactId> 
      <version>1.8</version> 
      <dependencies> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjrt</artifactId> 
        <version>${aspectj.version}</version> 
       </dependency> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjtools</artifactId> 
        <version>${aspectj.version}</version> 
       </dependency> 
      </dependencies> 
      <executions> 
       <execution> 
        <phase>process-sources</phase> 
        <goals> 
         <goal>compile</goal> 
         <goal>test-compile</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <outxml>true</outxml> 
       <aspectLibraries> 
        <aspectLibrary> 
         <groupId>org.springframework</groupId> 
         <artifactId>spring-aspects</artifactId> 
        </aspectLibrary> 
       </aspectLibraries> 
       <complianceLevel>${java.version}</complianceLevel> 
       <source>${java.version}</source> 
       <target>${java.version}</target> 
       <forceAjcCompile>true</forceAjcCompile> 
      </configuration> 
     </plugin> 
... 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-eclipse-plugin</artifactId> 
      <version>2.7</version> 
      <configuration> 
       <downloadSources>true</downloadSources> 
       <downloadJavadocs>false</downloadJavadocs> 
       <wtpversion>2.0</wtpversion> 
       <additionalBuildcommands> 
        <buildCommand> 
         <name>org.eclipse.ajdt.core.ajbuilder</name> 
         <arguments> 
          <aspectPath>org.springframework.aspects</aspectPath> 
         </arguments> 
        </buildCommand> 
        <buildCommand> 
         <name>org.springframework.ide.eclipse.core.springbuilder</name> 
        </buildCommand> 
       </additionalBuildcommands> 
       <additionalProjectnatures> 
        <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature> 
        <projectnature>com.springsource.sts.roo.core.nature</projectnature> 
        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> 
       </additionalProjectnatures> 
      </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

Полная выходная ошибка:

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building kkos01 0.1.0.BUILD-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-eclipse-plugin:2.7:clean (default-cli) @ kkos01 --- 
[INFO] Deleting file: .project 
[INFO] Deleting file: .classpath 
[INFO] Deleting file: .wtpmodules 
[INFO] Deleting file: .component 
[INFO] Deleting file: org.eclipse.wst.common.component 
[INFO] Deleting file: org.eclipse.wst.common.project.facet.core.xml 
[INFO] Deleting file: org.eclipse.jdt.core.prefs 
[INFO] Deleting file: org.eclipse.ajdt.ui.prefs 
[INFO] 
[INFO] >>> maven-eclipse-plugin:2.7:eclipse (default-cli) > generate-resources @ kkos01 >>> 
[INFO] 
[INFO] --- aspectj-maven-plugin:1.8:compile (default) @ kkos01 --- 
[INFO] Showing AJC message detail for messages of types: [error, warning, fail] 
[WARNING] can't find type org.w3c.dom.ElementTraversal whilst determining signatures of call or execution join point for java.lang.String com.gargoylesoftware.htmlunit.html.HtmlElement.getAttribute(java.lang.String), this may cause a pointcut to fail to match at this join point 
when weaving type kk.os.scrape.ScreenCaptureHtmlUnitDriver 
when weaving classes 
when weaving 
when batch building BuildConfig[null] #Files=1315 AopXmls=#0 
[Xlint:cantFindTypeAffectingJPMatch] 
    C:\sync\workspace-kkos\kkos01\src\main\java\kk\os\scrape\ScreenCaptureHtmlUnitDriver.java:0 
(no source information available) 

[WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch] 
    C:\sync\workspace-kkos\kkos01\org\springframework\mock\staticmock\AnnotationDrivenStaticEntityMockingControl.aj:117 

[INFO] 
[INFO] --- aspectj-maven-plugin:1.8:test-compile (default) @ kkos01 --- 
[INFO] Showing AJC message detail for messages of types: [error, warning, fail] 
[ERROR] no sources specified 
    <unknown source file>:<no line information> 

[ERROR] AspectJ Compiler 1.8.0 

    Usage: <options> <source file | @argfile>.. 

AspectJ-specific options: 
    -inpath <list>  use classes in dirs and jars/zips in <list> as source 
         (<list> uses platform-specific path delimiter) 
    -injars <jarList> use classes in <jarList> zip files as source 
         (<jarList> uses classpath delimiter) 
         deprecated - use inpath instead. 
    -aspectpath <list> weave aspects in .class files from <list> dirs and jars/zip into sources 
         (<list> uses classpath delimiter) 
    -outjar <file>  put output classes in zip file <file> 
    -outxml    generate META-INF/aop.xml 
    -outxmlfile <file> specify alternate destination output of -outxml 
    -argfile <file>  specify line-delimited list of source files 
    -showWeaveInfo  display information about weaving 
    -incremental  continuously-running compiler, needs -sourceroots 
         (reads stdin: enter to recompile and 'q' to quit) 
    -sourceroots <dirs> compile all .aj and .java files in <dirs> 
         (<dirs> uses classpath delimiter) 
    -crossrefs   generate .ajsym file into the output directory 
    -emacssym   generate .ajesym symbol files for emacs support 
    -Xlint    same as '-Xlint:warning' 
    -Xlint:<level>  set default level for crosscutting messages 
         (<level> may be ignore, warning, or error) 
    -Xlintfile <file> specify properties file to set per-message levels 
         (cf org/aspectj/weaver/XlintDefault.properties) 
    -X     print help on non-standard options 

Standard Eclipse compiler options: 
Options enabled by default are prefixed with '+' 

Classpath options: 
    -cp -classpath <directories and zip/jar files separated by ;> 
         specify location for application classes and sources 
    -bootclasspath <directories and zip/jar files separated by ;> 
         specify location for system classes 
    -d <dir>   destination directory (if omitted, no directory is created) 
    -d none   generate no .class files 
    -encoding <enc> specify custom encoding for all sources. Each file/directory can override it 
         when suffixed with '['<enc>']' (e.g. X.java[utf8]) 

Compliance options: 
    -1.3    use 1.3 compliance level (implicit -source 1.3 -target 1.1) 
    -1.4    + use 1.4 compliance level 
    -1.5 -5 -5.0  use 1.5 compliance (-source 1.5 -target 1.5) 
    -1.6 -6 -6.0  use 1.6 compliance (-source 1.6 -target 1.6) 
    -1.7 -7 -7.0  use 1.7 compliance (-source 1.7 -target 1.7) 
    -1.8 -8 -8.0  use 1.8 compliance (-source 1.8 -target 1.8) 
    -source <version> set source level: 1.3 to 1.8 (or 5, 5.0, etc) 
    -target <version> set classfile target: 1.1 to 1.8 (or 5, 5.0, etc) 

Warning options: 
    -deprecation   + deprecation outside deprecated code 
    -nowarn -warn:none disable all warnings 
    -warn:<warnings separated by ,> enable exactly the listed warnings 
    -warn:+<warnings separated by ,> enable additional warnings 
    -warn:-<warnings separated by ,> disable specific warnings 
     allDeadCode   dead code including trivial if(DEBUG) check 
     allDeprecation  deprecation including inside deprecated code 
     allJavadoc   invalid or missing javadoc 
     allOver-ann   all missing @Override annotations 
     all-static-method all method can be declared as static warnings 
     assertIdentifier + 'assert' used as identifier 
     boxing    autoboxing conversion 
     charConcat   + char[] in String concat 
     compareIdentical + comparing identical expressions 
     conditionAssign  possible accidental boolean assignment 
     constructorName + method with constructor name 
     deadCode   + dead code excluding trivial if (DEBUG) check 
     dep-ann    missing @Deprecated annotation 
     deprecation  + deprecation outside deprecated code 
     discouraged  + use of types matching a discouraged access rule 
     emptyBlock   undocumented empty block 
     enumIdentifier  'enum' used as identifier 
     enumSwitch   incomplete enum switch 
     fallthrough   possible fall-through case 
     fieldHiding   field hiding another variable 
     finalBound   type parameter with final bound 
     finally   + finally block not completing normally 
     forbidden   + use of types matching a forbidden access rule 
     hashCode    missing hashCode() method when overriding equals() 
     hiding    macro for fieldHiding, localHiding, typeHiding and 
          maskedCatchBlock 
     includeAssertNull raise null warnings for variables 
          that got tainted in an assert expression 
     indirectStatic  indirect reference to static member 
     intfAnnotation  + annotation type used as super interface 
     intfNonInherited + interface non-inherited method compatibility 
     intfRedundant  find redundant superinterfaces 
     javadoc    invalid javadoc 
     localHiding   local variable hiding another variable 
     maskedCatchBlock + hidden catch block 
     nls     string literal lacking non-nls tag //$NON-NLS-<n>$ 
     noEffectAssign  + assignment without effect 
     null     potential missing or redundant null check 
     nullDereference + missing null check 
     over-ann    missing @Override annotation (superclass) 
     paramAssign   assignment to a parameter 
     pkgDefaultMethod + attempt to override package-default method 
     raw    + usage of raw type 
     semicolon   unnecessary semicolon, empty statement 
     serial    + missing serialVersionUID 
     specialParamHiding constructor or setter parameter hiding a field 
     static-method  method can be declared as static 
     static-access  macro for indirectStatic and staticReceiver 
     staticReceiver  + non-static reference to static member 
     super    overriding a method without making a super invocation 
     suppress   + enable @SuppressWarnings 
          When used with -err:, it can also silent optional 
          errors and warnings 
     syncOverride   missing synchronized in synchr. method override 
     syntheticAccess  synthetic access for innerclass 
     tasks(<tags separated by |>) tasks identified by tags inside comments 
     typeHiding   + type parameter hiding another type 
     unavoidableGenericProblems + ignore unavoidable type safety problems 
            due to raw APIs 
     unchecked   + unchecked type operation 
     unnecessaryElse  unnecessary else clause 
     unqualifiedField  unqualified reference to field 
     unused    macro for unusedAllocation, unusedArgument, 
           unusedImport, unusedLabel, unusedLocal, 
           unusedPrivate, unusedThrown, and unusedTypeArgs 
     unusedAllocation  allocating an object that is not used 
     unusedArgument  unread method parameter 
     unusedImport  + unused import declaration 
     unusedLabel  + unused label 
     unusedLocal  + unread local variable 
     unusedPrivate  + unused private member declaration 
     unusedThrown   unused declared thrown exception 
     unusedTypeArgs  + unused type arguments for method and constructor 
     uselessTypeCheck  unnecessary cast/instanceof operation 
     varargsCast  + varargs argument need explicit cast 
     warningToken  + unsupported or unnecessary @SuppressWarnings 

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 26.469 s 
[INFO] Finished at: 2016-08-17T19:03:39+02:00 
[INFO] Final Memory: 40M/1833M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.8:test-compile (default) on project kkos01: AJC compiler errors: 
[ERROR] error no sources specified 
[ERROR] abort AspectJ Compiler 1.8.0 
[ERROR] 
[ERROR] Usage: <options> <source file | @argfile>.. 
[ERROR] 
[ERROR] AspectJ-specific options: 
[ERROR] -inpath <list>  use classes in dirs and jars/zips in <list> as source 
[ERROR] (<list> uses platform-specific path delimiter) 
[ERROR] -injars <jarList> use classes in <jarList> zip files as source 
[ERROR] (<jarList> uses classpath delimiter) 
[ERROR] deprecated - use inpath instead. 
[ERROR] -aspectpath <list> weave aspects in .class files from <list> dirs and jars/zip into sources 
[ERROR] (<list> uses classpath delimiter) 
[ERROR] -outjar <file>  put output classes in zip file <file> 
[ERROR] -outxml    generate META-INF/aop.xml 
[ERROR] -outxmlfile <file> specify alternate destination output of -outxml 
[ERROR] -argfile <file>  specify line-delimited list of source files 
[ERROR] -showWeaveInfo  display information about weaving 
[ERROR] -incremental  continuously-running compiler, needs -sourceroots 
[ERROR] (reads stdin: enter to recompile and 'q' to quit) 
[ERROR] -sourceroots <dirs> compile all .aj and .java files in <dirs> 
[ERROR] (<dirs> uses classpath delimiter) 
[ERROR] -crossrefs   generate .ajsym file into the output directory 
[ERROR] -emacssym   generate .ajesym symbol files for emacs support 
[ERROR] -Xlint    same as '-Xlint:warning' 
[ERROR] -Xlint:<level>  set default level for crosscutting messages 
[ERROR] (<level> may be ignore, warning, or error) 
[ERROR] -Xlintfile <file> specify properties file to set per-message levels 
[ERROR] (cf org/aspectj/weaver/XlintDefault.properties) 
[ERROR] -X     print help on non-standard options 
[ERROR] 
[ERROR] Standard Eclipse compiler options: 
[ERROR] Options enabled by default are prefixed with '+' 
[ERROR] 
[ERROR] Classpath options: 
[ERROR] -cp -classpath <directories and zip/jar files separated by ;> 
[ERROR] specify location for application classes and sources 
[ERROR] -bootclasspath <directories and zip/jar files separated by ;> 
[ERROR] specify location for system classes 
[ERROR] -d <dir>   destination directory (if omitted, no directory is created) 
[ERROR] -d none   generate no .class files 
[ERROR] -encoding <enc> specify custom encoding for all sources. Each file/directory can override it 
[ERROR] when suffixed with '['<enc>']' (e.g. X.java[utf8]) 
[ERROR] 
[ERROR] Compliance options: 
[ERROR] -1.3    use 1.3 compliance level (implicit -source 1.3 -target 1.1) 
[ERROR] -1.4    + use 1.4 compliance level 
[ERROR] -1.5 -5 -5.0  use 1.5 compliance (-source 1.5 -target 1.5) 
[ERROR] -1.6 -6 -6.0  use 1.6 compliance (-source 1.6 -target 1.6) 
[ERROR] -1.7 -7 -7.0  use 1.7 compliance (-source 1.7 -target 1.7) 
[ERROR] -1.8 -8 -8.0  use 1.8 compliance (-source 1.8 -target 1.8) 
[ERROR] -source <version> set source level: 1.3 to 1.8 (or 5, 5.0, etc) 
[ERROR] -target <version> set classfile target: 1.1 to 1.8 (or 5, 5.0, etc) 
[ERROR] 
[ERROR] Warning options: 
[ERROR] -deprecation   + deprecation outside deprecated code 
[ERROR] -nowarn -warn:none disable all warnings 
[ERROR] -warn:<warnings separated by ,> enable exactly the listed warnings 
[ERROR] -warn:+<warnings separated by ,> enable additional warnings 
[ERROR] -warn:-<warnings separated by ,> disable specific warnings 
[ERROR] allDeadCode   dead code including trivial if(DEBUG) check 
[ERROR] allDeprecation  deprecation including inside deprecated code 
[ERROR] allJavadoc   invalid or missing javadoc 
[ERROR] allOver-ann   all missing @Override annotations 
[ERROR] all-static-method all method can be declared as static warnings 
[ERROR] assertIdentifier + 'assert' used as identifier 
[ERROR] boxing    autoboxing conversion 
[ERROR] charConcat   + char[] in String concat 
[ERROR] compareIdentical + comparing identical expressions 
[ERROR] conditionAssign  possible accidental boolean assignment 
[ERROR] constructorName + method with constructor name 
[ERROR] deadCode   + dead code excluding trivial if (DEBUG) check 
[ERROR] dep-ann    missing @Deprecated annotation 
[ERROR] deprecation  + deprecation outside deprecated code 
[ERROR] discouraged  + use of types matching a discouraged access rule 
[ERROR] emptyBlock   undocumented empty block 
[ERROR] enumIdentifier  'enum' used as identifier 
[ERROR] enumSwitch   incomplete enum switch 
[ERROR] fallthrough   possible fall-through case 
[ERROR] fieldHiding   field hiding another variable 
[ERROR] finalBound   type parameter with final bound 
[ERROR] finally   + finally block not completing normally 
[ERROR] forbidden   + use of types matching a forbidden access rule 
[ERROR] hashCode    missing hashCode() method when overriding equals() 
[ERROR] hiding    macro for fieldHiding, localHiding, typeHiding and 
[ERROR] maskedCatchBlock 
[ERROR] includeAssertNull raise null warnings for variables 
[ERROR] that got tainted in an assert expression 
[ERROR] indirectStatic  indirect reference to static member 
[ERROR] intfAnnotation  + annotation type used as super interface 
[ERROR] intfNonInherited + interface non-inherited method compatibility 
[ERROR] intfRedundant  find redundant superinterfaces 
[ERROR] javadoc    invalid javadoc 
[ERROR] localHiding   local variable hiding another variable 
[ERROR] maskedCatchBlock + hidden catch block 
[ERROR] nls     string literal lacking non-nls tag //$NON-NLS-<n>$ 
[ERROR] noEffectAssign  + assignment without effect 
[ERROR] null     potential missing or redundant null check 
[ERROR] nullDereference + missing null check 
[ERROR] over-ann    missing @Override annotation (superclass) 
[ERROR] paramAssign   assignment to a parameter 
[ERROR] pkgDefaultMethod + attempt to override package-default method 
[ERROR] raw    + usage of raw type 
[ERROR] semicolon   unnecessary semicolon, empty statement 
[ERROR] serial    + missing serialVersionUID 
[ERROR] specialParamHiding constructor or setter parameter hiding a field 
[ERROR] static-method  method can be declared as static 
[ERROR] static-access  macro for indirectStatic and staticReceiver 
[ERROR] staticReceiver  + non-static reference to static member 
[ERROR] super    overriding a method without making a super invocation 
[ERROR] suppress   + enable @SuppressWarnings 
[ERROR] When used with -err:, it can also silent optional 
[ERROR] errors and warnings 
[ERROR] syncOverride   missing synchronized in synchr. method override 
[ERROR] syntheticAccess  synthetic access for innerclass 
[ERROR] tasks(<tags separated by |>) tasks identified by tags inside comments 
[ERROR] typeHiding   + type parameter hiding another type 
[ERROR] unavoidableGenericProblems + ignore unavoidable type safety problems 
[ERROR] due to raw APIs 
[ERROR] unchecked   + unchecked type operation 
[ERROR] unnecessaryElse  unnecessary else clause 
[ERROR] unqualifiedField  unqualified reference to field 
[ERROR] unused    macro for unusedAllocation, unusedArgument, 
[ERROR] unusedImport, unusedLabel, unusedLocal, 
[ERROR] unusedPrivate, unusedThrown, and unusedTypeArgs 
[ERROR] unusedAllocation  allocating an object that is not used 
[ERROR] unusedArgument  unread method parameter 
[ERROR] unusedImport  + unused import declaration 
[ERROR] unusedLabel  + unused label 
[ERROR] unusedLocal  + unread local variable 
[ERROR] unusedPrivate  + unused private member declaration 
[ERROR] unusedThrown   unused declared thrown exception 
[ERROR] unusedTypeArgs  + unused type arguments for method and constructor 
[ERROR] uselessTypeCheck  unnecessary cast/instanceof operation 
[ERROR] varargsCast  + varargs argument need explicit cast 
[ERROR] warningToken  + unsupported or unnecessary @SuppressWarnings 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
+0

Я ничего не знаю о _Eclipse Maven_ плагине или _Spring Roo_. Тем не менее, я регулярно использую простой AspectJ в связи с плагином _AspectJ Maven_. Если вы хотите упростить свой POM, чтобы избавиться от _Eclipse Maven_ и по-прежнему сталкиваться с теми же проблемами впоследствии, я мог бы вам помочь. – kriegaex

ответ

2

Почему вы используете Maven-затмение-плагин? Этот плагин (RETIRED) (см plugin project page)

Вы пытались импорта проекта в Существующий Maven проект использованием Maven плагин intregration для затмения?

Как ваш проект использует AspectJ и Spring, проверьте проект Spring Tool Suit [STS]. Эта настройка eclipse объединяет все, что вам нужно по умолчанию.

Удачи вам!

+0

Спасибо за предложение. Я уже использую STS (и, по-видимому, также m2e - странно). Можете ли вы дать более подробное объяснение, где найти _import проект как существующий проект maven_? –

+0

См. Http://stackoverflow.com/a/7711398/2295657. Удачи! – jmvivo

Смежные вопросы