我在编译简单的achilles maven项目时遇到了一些问题。 我的pom.xml:
<dependencies>
<dependency>
<groupId>info.archinnov</groupId>
<artifactId>achilles-core</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>info.archinnov</groupId>
<artifactId>achilles-model</artifactId>
<version>4.2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
</plugins>
</build>
我在这里配置了Intellij Idea Annotation Process:https://github.com/doanduyhai/Achilles/wiki/IDE-configuration
当我尝试运行mvn -X clean install时,我有一些错误编译:
[ERROR] /home/konrad/Pulpit/CassandraAchilles/target/generated-sources/annotations/info/archinnov/achilles/generated/meta/entity/User_AchillesMeta.java:[49,69] cannot find symbol
symbol: class User
[ERROR] /home/konrad/Pulpit/CassandraAchilles/target/generated-sources/annotations/info/archinnov/achilles/generated/manager/User_Manager.java:[25,57] cannot find symbol
symbol: class User
[ERROR] /home/konrad/Pulpit/CassandraAchilles/target/generated-sources/annotations/info/archinnov/achilles/generated/meta/entity/User_AchillesMeta.java:[59,38] cannot find symbol
symbol: class User
location: class info.archinnov.achilles.generated.meta.entity.User_AchillesMeta
[ERROR] /home/konrad/Pulpit/CassandraAchilles/target/generated-sources/annotations/info/archinnov/achilles/generated/meta/entity/User_AchillesMeta.java:[70,38] cannot find symbol
symbol: class User
location: class info.archinnov.achilles.generated.meta.entity.User_AchillesMeta
用户是我的实体:
import info.archinnov.achilles.annotations.Column;
import info.archinnov.achilles.annotations.PartitionKey;
import info.archinnov.achilles.annotations.Table;
@Table(keyspace = "example", table = "user")
public class User {
@PartitionKey
private Long id;
@Column("fname")
private String firstName;
@Column("age")
private int age;
public User() {
}
public User(Long id, String firstName, int age) {
this.id = id;
this.firstName = firstName;
this.age = age;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
我做错了什么?
答案 0 :(得分:0)
对我来说将User
类包含到软件包中解决了该问题。
问题似乎出在代码生成的方式上,正如您提到的IDE configuration page末尾所解释的:
在某些情况下,如果处理器无法正确生成代码,则可能需要使用Maven进行干净的构建(实际上,这是唯一在任何情况下都可以100%运行的方法)。为此,请打开外壳程序终端并键入
mvn clean compile
,然后返回IDE并刷新您的项目,您应该会看到生成的代码。