我有一个带有 Groovy 和 Java 类的应用程序。在 IDEA 11 下编译工作正常,但是当我尝试使用 Maven 编译时它失败了。
项目结构:src/main/groovy - 用于 groovy 类,src/main/java - 用于 java 类。例如,类 TemplateWriter 尝试使用 groovy 类 AbstractTemplate。
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\io\TemplateWriter.java:[16,29] cannot find symbol
symbol : class AbstractTemplate
类似的答案在这里。但没有任何帮助:(
我的 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>adapter-builder</groupId>
<artifactId>adapter-builder</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
maven:compile 的全部输出
"C:\Program Files (x86)\Java\jdk1.6.0_31\bin\java" -Dclassworlds.conf=C:\apache-maven-2.2.1\bin\m2.conf -Dmaven.home=C:\apache-maven-2.2.1 -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.0\bin" -Dfile.encoding=UTF-8 -classpath "C:\apache-maven-2.2.1\boot\classworlds-1.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.0\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --no-plugin-updates --strict-checksums --update-snapshots -f D:\Projects\SMEV\_Generator\adapter-builder\pom.xml compile
+ Enabling strict checksum verification on all artifact downloads.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - adapter-builder:adapter-builder:jar:1.0
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Projects\SMEV\_Generator\adapter-builder\src\main\resources
[INFO] [compiler:compile {execution: default-compile}]
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 37 source files to D:\Projects\SMEV\_Generator\adapter-builder\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[7,0] package com.itransition.smev.builder.templates does not exist
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\io\TemplateWriter.java:[3,45] package com.itransition.smev.builder.templates does not exist
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\io\TemplateWriter.java:[16,29] cannot find symbol
symbol : class AbstractTemplate
location: class com.itransition.smev.builder.io.TemplateWriter
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[23,8] cannot find symbol
symbol : class VarTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[23,35] cannot find symbol
symbol : class VarTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[38,8] cannot find symbol
symbol : class WsXwikiSetDocTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[38,45] cannot find symbol
symbol : class WsXwikiSetDocTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[46,8] cannot find symbol
symbol : class WsXwikiSetDocRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[46,52] cannot find symbol
symbol : class WsXwikiSetDocRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[57,8] cannot find symbol
symbol : class WsXwikiSetDocResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[57,53] cannot find symbol
symbol : class WsXwikiSetDocResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[68,8] cannot find symbol
symbol : class WsXwikiGetSignRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[68,53] cannot find symbol
symbol : class WsXwikiGetSignRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[79,8] cannot find symbol
symbol : class WsFoivRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[79,45] cannot find symbol
symbol : class WsFoivRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[89,8] cannot find symbol
symbol : class TplRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[89,42] cannot find symbol
symbol : class TplRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[99,8] cannot find symbol
symbol : class TplResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[ERROR] \Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[99,43] cannot find symbol
symbol : class TplResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[INFO] 19 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[7,0] package com.itransition.smev.builder.templates does not exist
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\io\TemplateWriter.java:[3,45] package com.itransition.smev.builder.templates does not exist
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\io\TemplateWriter.java:[16,29] cannot find symbol
symbol : class AbstractTemplate
location: class com.itransition.smev.builder.io.TemplateWriter
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[23,8] cannot find symbol
symbol : class VarTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[23,35] cannot find symbol
symbol : class VarTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[38,8] cannot find symbol
symbol : class WsXwikiSetDocTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[38,45] cannot find symbol
symbol : class WsXwikiSetDocTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[46,8] cannot find symbol
symbol : class WsXwikiSetDocRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[46,52] cannot find symbol
symbol : class WsXwikiSetDocRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[57,8] cannot find symbol
symbol : class WsXwikiSetDocResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[57,53] cannot find symbol
symbol : class WsXwikiSetDocResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[68,8] cannot find symbol
symbol : class WsXwikiGetSignRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[68,53] cannot find symbol
symbol : class WsXwikiGetSignRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[79,8] cannot find symbol
symbol : class WsFoivRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[79,45] cannot find symbol
symbol : class WsFoivRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[89,8] cannot find symbol
symbol : class TplRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[89,42] cannot find symbol
symbol : class TplRequestTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[99,8] cannot find symbol
symbol : class TplResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
\Projects\SMEV\_Generator\adapter-builder\src\main\java\com\itransition\smev\builder\core\AdapterFileGenerator.java:[99,43] cannot find symbol
symbol : class TplResponseTemplate
location: class com.itransition.smev.builder.core.AdapterFileGenerator
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Fri Dec 07 04:57:10 VET 2012
[INFO] Final Memory: 12M/33M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 1