import org.appfuse.webapp.action.BaseAction无法解析

我正在按照指南http://appfuse.org/display/APF/Using+Struts+2制作一个简单的appfuse网站,但是在使用Maven进行编译时遇到了错误,Maven正在报告org.appfuse.webapp.action。 BaseAction不存在。 我从谷歌搜索了很多没有运气,任何人都可以给我一些提示,感谢任何帮助,想法或建议。谢谢 maven 2.2.1和3都产生了同样的错误: 使用archetype:appfuse-basic-struts-archetype,v.2.1.0-M1 maven命令:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -
DarchetypeArtifactId=appfuse-basic-struts-archetype -DarchetypeVersion=2.1.0-M1 
-DgroupId=com.mycompany -DartifactId=myproject
在这个pt,mvn test或jetty:run-war没有引发错误。 但是,当我添加2个类(PersonActionTest和PersonAction)时,它无法编译 PersonActionTest:src test java com mycompany webapp webapp action
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 main java com mycompany webapp webapp action
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] ^^^^^^^^^^^^^^^^^
截断,因为msg的其余部分类似 谢谢〜 史蒂芬     
已邀请:
我不是Appfuse专家(我的意思是,我不知道所有变化和现有问题的细节)但是使用原型2.1.0-M1版本生成的项目错过了
appfuse-struts
工件(其中提供
o.a.w.a.BaseAction
)。 我试图手动添加它,但后来遇到了一些其他的工件解决问题(找不到传递依赖)并且放弃了。 但是,您使用以前版本的原型(即版本2.0.2)获得的项目看起来不错,我的建议是使用此版本:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes 
    -DarchetypeArtifactId=appfuse-basic-struts 
    -DarchetypeVersion=2.0.2 
    -DgroupId=com.mycompany 
    -DartifactId=myproject
    
我知道这个线程已经很老了,但我现在多次出现这个错误,所以我想分享我的解决方案。 我最近在以下设置中出现此错误。 *有一个项目,比如Util,它导入一个库,例如dbcp *另一个项目,比如App,取决于Util,方面将应用于该项目。 *我向App添加了一个新类,它使用了传递依赖,例如,新类C实现了dbcp的一些抽象类。因为App依赖于Util,所以dbcp在eclipse中是可见的,一切都很好。但是,当我使用mvn install在命令行上编译项目时,aspectj插件失败,并指出无法解析dbcp的导入。 *包括从App到dbcp的直接依赖解决问题(对我来说)。 因此,在java编译器插件中,aspectj不使用传递依赖。可能新C类的位置不是“最优”,它应该转移到Util项目,但这是一个不同的问题。 希望能帮助任何人来到这个主题。     

要回复问题请先登录注册