我有一个数据类DPOSTerminalRecord
。我内部有一个名为LimitedList
的嵌入式数据类。我正在使用带有DN增强器的MongoDB的DataNucleus JDO。
执行mvn clean package
命令时,我得到以下内容:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project MainProject: Compilation failure
[ERROR] /Users/rhs/git/Project/MainProject/target/generated-sources/annotations/com/rhs/data/QDPOSTerminalRecord.java:[32,53] cannot find symbol
[ERROR] symbol: class QLimitedList
[ERROR] location: class com.rhs.data.DPOSTerminalRecord
知道如何解决这个问题吗?我在LimitedList
文件中没有看到QDPOSTerminalRecord.java
类。我在Eclipse编译中没有任何问题,只有Maven。在Eclipse中,日志显示正在增强com.rhs.data.DPOSTerminalRecord$LimitedClass
。我错过了什么?
编辑:添加了我班级的快速视图
@PersistenceCapable
public class DPOSTerminalRecord {
@PrimaryKey
private String _id; // this is the device ID
private String _name; // this is the last logged name for the device
@PersistenceCapable
@EmbeddedOnly
private static class LimitedList<E> // the limited list type automatically dumps the last object out of the list when the capacity is reached.
{
@Persistent
int capacity;
@Persistent
private ArrayList<E> list;
public LimitedList(int initialCapacity) {
capacity = initialCapacity;
list = new ArrayList<E>(capacity);
}
public boolean add(E e)
{
if(list.size() == capacity)
{
// dump the last object
list.remove(capacity - 1);
}
return list.add(e);
}
}
@Embedded(members={
@Persistent(name="capacity", column="capacity"),
@Persistent(name="list", column="list")
})
@Persistent
private LimitedList<String> m_knownNames = new LimitedList<String>(5);
public DPOSTerminalRecord(String id, String name) {
super();
_id = id;
_name = name;
}
...etc
edit2:添加了生成的类
package com.rhs.data;
import javax.jdo.query.*;
import org.datanucleus.api.jdo.query.*;
public class QDPOSTerminalRecord extends PersistableExpressionImpl<DPOSTerminalRecord> implements PersistableExpression<DPOSTerminalRecord>
{
public static final QDPOSTerminalRecord jdoCandidate = candidate("this");
public static QDPOSTerminalRecord candidate(String name)
{
return new QDPOSTerminalRecord(null, name, 5);
}
public static QDPOSTerminalRecord candidate()
{
return jdoCandidate;
}
public static QDPOSTerminalRecord parameter(String name)
{
return new QDPOSTerminalRecord(DPOSTerminalRecord.class, name, ExpressionType.PARAMETER);
}
public static QDPOSTerminalRecord variable(String name)
{
return new QDPOSTerminalRecord(DPOSTerminalRecord.class, name, ExpressionType.VARIABLE);
}
public final StringExpression _id;
public final StringExpression _name;
public final com.rhs.data.DPOSTerminalRecord.QLimitedList m_knownNames; // This is the infringing line since there is no QLimitedList inside this file
public QDPOSTerminalRecord(PersistableExpression parent, String name, int depth)
{
super(parent, name);
this._id = new StringExpressionImpl(this, "_id");
this._name = new StringExpressionImpl(this, "_name");
if (depth > 0)
{
this.m_knownNames = new com.rhs.data.DPOSTerminalRecord.QLimitedList(this, "m_knownNames", depth-1);
}
else
{
this.m_knownNames = null;
}
}
public QDPOSTerminalRecord(Class type, String name, ExpressionType exprType)
{
super(type, name, exprType);
this._id = new StringExpressionImpl(this, "_id");
this._name = new StringExpressionImpl(this, "_name");
this.m_knownNames = new com.rhs.data.DPOSTerminalRecord.QLimitedList(this, "m_knownNames", 5);
}
}