For a variety of reason my colleagues and I had to change core classes. We
needed to adjust the whole AppFuse security framework to use ACL and not
GrantedAuthority (roles). For this we had to modify some core classes (e.g.
in appfuse-data-common as described in
http://www.appfuse.org/display/APF/AppFuse+Core+Classes) but also in other
modules such as appfuse-ibatis (e.g. appfuse-${dao.framework}. We also
wanted to fix an issue with the BaseDaoTestCase populate method (see thread:
http://www.nabble.com/BaseDaoTestCase-populate-method-tf4094379.html#a11643122
). 

Our main problem was: everything compiles fine but tests simply use the
module from the repository and not our classes.

I followed many threads regarding resolving the dependencies and it took me
a lot of time to get it right (well, it works any way...). The
configurations in the 'Exclude the AppFuse Data Common Package' in AppFuse
Core Classes - AppFuse 2 - Confluence did not work for us. What did is this
(in four stages):

1)    <dependency>
            <groupId>org.appfuse</groupId>
            <artifactId>appfuse-${web.framework}</artifactId>
            <version>${appfuse.version}</version>
            <type>warpath</type>
            <!-- This exclusion and the dependency following this one allow
DAO framework switching. -->
            <!-- You only need these if you want to use JPA or iBATIS. See
APF-565 for more information. -->
            <!-- It does no harm to leave it in for Hibernate, but it's not
needed. -->
            <exclusions>
                <exclusion>
                    <groupId>org.appfuse</groupId>
                    <artifactId>appfuse-hibernate</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.appfuse</groupId>
                    <artifactId>appfuse-data-common</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.appfuse</groupId>
                    <artifactId>appfuse-${dao.framework}</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

2) We comment out the following

        <!-- We override much of the core classes, including tests
             so we do not want the dependency
        <dependency>
            <groupId>org.appfuse</groupId>
            <artifactId>appfuse-${dao.framework}</artifactId>
            <version>${appfuse.version}</version>
            <scope>provided</scope>
        </dependency>
        -->

The ${dao.framework} being ibatis. This will cause all your
javax.persistence to yield errors so:

3) We take the time to download the required jar and add this (I added the
property ejb.version to the pom):

<!-- However, we still need annotations (we have to install this using: mvn
install:install-file -DgroupId=javax.persistence -DartifactId=ejb
-Dversion=3.0-public_review -Dpackaging=jar
-Dfile="path/to/hibernate-annotations-3.3.0.GA/lib/ejb3-persistence.jar"
             which we have to download from
http://prdownloads.sourceforge.net/hibernate -->

        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>ejb</artifactId>
            <version>${ejb.version}</version>
        </dependency>

4) Finally - we can't ignore iBATIS altogether so:

<!--  and we still need iBATIS support (just not appfuse-ibatis) -->
        <dependency>
            <groupId>org.apache.ibatis</groupId>
            <artifactId>ibatis-sqlmap</artifactId>
            <version>${ibatis.version}</version>
        </dependency>

Now - notice this: Before removing the dependency of appfuse-iBATIS, grab
the applicationContext-dao.xml from the appfuse-ibatis...jar in your
repository and paste it into src/main/resources (if it is not copied during
tests to src/test/resources - copy it your self).

This should allow you to change the core (not just the model classes in
appfuse-data-common) and have the framework reffer to your modifications and
not the ones in the repository. 

I hope this saves you some time in case you need similar configurations and
that you report if you find this silly or redundant...





-- 
View this message in context: 
http://www.nabble.com/Modifying-core-classes-and-resolving-dependencies-in-2.0-M5-Struts-tf4550838s2369.html#a12987109
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to