我按照指南http://appfuse.org/display/APF/Using+Struts+2制作了一个简单的appfuse网站,但是在编译Maven时报错了,它报告了org.appfuse.webapp.action.BaseAction不存在。import org.appfuse.webapp.action.BaseAction无法解析
我搜索了很多从谷歌没有运气,任何人都可以给我一个提示,欣赏任何帮助,想法或建议。三江源
既行家2.2.1和3中产生相同的错误:在使用原型 :AppFuse的碱性-支杆-原型,v.2.1.0-M1
行家命令:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -
DarchetypeArtifactId=appfuse-basic-struts-archetype -DarchetypeVersion=2.1.0-M1
-DgroupId=com.mycompany -DartifactId=myproject
at this pt,mvn test or jetty:run-war没有提出错误。
然而,当我加2类(PersonActionTest和的PersonAction)如下,它无法编译
PersonActionTest: SRC \测试\ java中\ COM \ myCompany中\ web应用\ web应用\动作
package com.mycompany.webapp.action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import org.appfuse.service.GenericManager;
import org.appfuse.tutorial.model.Person; \\this fails to compile
import org.appfuse.webapp.action.BaseActionTestCase; \\this fails to compile
import org.springframework.mock.web.MockHttpServletRequest;
public class PersonActionTest extends BaseActionTestCase {
private PersonAction action;
@Override
protected void onSetUpBeforeTransaction() throws Exception {
super.onSetUpBeforeTransaction();
action = new PersonAction();
GenericManager personManager = (GenericManager) applicationContext
.getBean("personManager");
action.setPersonManager(personManager);
// add a test person to the database
Person person = new Person();
person.setFirstName("Jack");
person.setLastName("Raible");
personManager.save(person);
}
public void testSearch() throws Exception {
assertEquals(action.list(), ActionSupport.SUCCESS);
assertTrue(action.getPersons().size() >= 1);
}
}
的PersonAction:的src \主\ java中的\ com \ myCompany的\ web应用程序\ web应用程序\行动
package com.mycompany.webapp.action;
import org.appfuse.webapp.action.BaseAction; \\this fails to compile
import org.appfuse.tutorial.model.Person; \\this fails to compile
import org.appfuse.service.GenericManager;
import java.util.List;
public class PersonAction extends BaseAction {
private GenericManager<Person, Long> personManager;
private List persons;
public void setPersonManager(GenericManager<Person, Long> personManager) {
this.personManager = personManager;
}
public List getPersons() {
return persons;
}
public String list() {
persons = personManager.getAll();
return SUCCESS;
}
}
错误消息:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Struts 2 Application 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- aspectj-maven-plugin:1.2:compile (default) @ realtest ---
[ERROR] The import org.appfuse.webapp cannot be resolved
[ERROR] The import org.appfuse.tutorial cannot be resolved
[ERROR] Person cannot be resolved to a type
[ERROR] Person cannot be resolved to a type
[ERROR] personManager cannot be resolved or is not a field
[ERROR] personManager cannot be resolved
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.285s
[INFO] Finished at: Thu Oct 21 09:35:56 CST 2010
[INFO] Final Memory: 6M/27M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.2:compil
e (default) on project realtest: Compiler errors :
[ERROR] error at import org.appfuse.webapp.action.BaseAction;
[ERROR] ^^^^^^^^^^^^^^^^^
截断味精的其余部分类似于
谢谢〜
史蒂芬
您需要提供更多详细信息。你使用了一个原型吗?如果是,请提供命令。您是否结帐来源?如果是,请提供命令。 – 2010-10-20 22:02:15
谢谢,详细信息已发布 – Mythox 2010-10-21 01:52:24