Hi Sue,

 

I’m pretty new at this stuff myself, but I’ve had a quick go at it too, to get 
a feel for it. I’m sure Mark will correct me if I’m wrong..

 

Going by these instructions, and assuming your compile was successful, I 
believe the key step is (c), adding appropriate dependencies.

Before trying some, have a look in 
[dspace-source]/dspace/modules/custom-api/target   -- you *should* see 
custom-api-1.5.1.jar or similar.

 

In my testing, I made a trivial change, set up the module poms, compiled with a 
new custom api module, then copied my new jar over to [dspace]/lib and the 
WEB-INF/lib folders in my webapps. It worked just fine. Adding appropriate 
dependencies from the start would have meant that update_webapps and 
update_code would have done that for me, if my understanding is correct.

 

For what it’s worth, I think that I’ll keep just using SVN for my 
testing/development source trees, and manage my small changes in the main 
source, but when I do deploy a patch live on an institution’s Dspace instance, 
I’ll use the custom project approach – it seems as though rapidly 
deploying/removing custom code would be quicker and less error-prone than 
altering code in place.

 

Cheers,

 

Kim.

 

From: Thornton, Susan M. (LARC-B702)[NCI INFORMATION SYSTEMS] 
[mailto:[email protected]] 
Sent: Thursday, 5 February 2009 12:47 p.m.
To: Diggory Mark
Cc: dspace-tech
Subject: Re: [Dspace-tech] Local modifications to DSpace .java programs,in 1.5.1

 

I think I’m still missing a piece of the puzzle though since my modified .java 
program is NOT making it into the dspace-api-1.5.1.jar file in /dspace/lib.

 

I have added the new sub-directory custom-api and file pom.xml file under 
{dspace-source}/dspace/modules.

I added the following to {dspace-source}/dspace/modules/pom.xml:  
<module>custom-api</module> (I also commented out the xmlui, lni, oai, and 
sword modules in this pom.xml file (for the time being until we are using them, 
as per your suggestion)).

I added the following to {dspace-source}/dspace/pom.xml:

<profile>

         <id>custom-api</id>

         <activation>

            <file>

               <exists>../custom-api/pom.xml</exists>

            </file>

         </activation>

         <modules>

            <module>../custom-api</module>

         </modules>

      </profile>

 

I think the trick is WHERE to put my custom .java program so that it will be 
picked up and put in the right place in the application once it’s compiled.

 

 

Take this example:

 

Let’s say I make a modification to:

 

            
dspace-1.5.1-src-release/dspace-api/src/main/java/org/dspace/app/mediafilter/PDFFilter.java
  

 

Do I put it in:

            
Dspace-1.5.1-src-release/dspace/modules/src/main/java/org/dspace/app/mediafilter/PDFFilter.java
    ????

 

 

And is the package in my new PDFFilter.java still package 
org.dspace.app.mediafilter;

 

I’m thinking maybe not since I just saw this in the pom.xml file you attached 
to your email last night:  <groupId>org.dspace.modules</groupId>

 

Do I need to create a {dspace-source}/custom-api directory??

 

Please forgive me – this is the first time I have worked with pom.xml files!

 

Thanks!

Sue

            

________________________________

From: Diggory Mark [mailto:[email protected]] 
Sent: Tuesday, February 03, 2009 5:24 PM
To: Thornton, Susan M. (LARC-B702)[NCI INFORMATION SYSTEMS]
Cc: dspace-tech
Subject: Re: [Dspace-tech] Local modifications to DSpace .java programs, in 
1.5.1

 

Or to be more explicit you add the pom at

 

{dspace-source}/dspace/modules/custom-api/pom.xml

 

and modify the following with <module>custom-api</module>

 

{dspace-source}/dspace/modules/pom.xml

 

And add custom-api as a dependency in 

 

{dspace-source}/dspace/pom.xml

 

Mark

 

On Feb 3, 2009, at 2:14 PM, Diggory Mark wrote:

 

no

 

On Feb 3, 2009, at 2:06 PM, Thornton, Susan M. (LARC-B702)[NCI INFORMATION 
SYSTEMS] wrote:

 

Do I need to modify {dspace-source}/pom.xml ??

 

________________________________

From: Diggory Mark [mailto:[email protected]] 
Sent: Tuesday, February 03, 2009 4:10 PM
To: Thornton, Susan M. (LARC-B702)[NCI INFORMATION SYSTEMS]
Cc: dspace-tech
Subject: Re: [Dspace-tech] Local modifications to DSpace .java programs, in 
1.5.1

 

Susan,

 

The way to do it without altering the code in place requires creating a custom 
maven project within the dspace/modules/ directory, wiring it into the 
dspace/pom.xml and dspace/modules/pom.xml so that it compiles into the build 
process.

 

At this point, I'm seeing community member using both approaches, and I'm 
unsure which I would most recommend. But here's what I try to approach as a 
best practice.

 

1.) I don't like to alter code in place in dspace-api, dspace-xmlui or any of 
those projects unless I intend to contribute it into the next release of DSpace 
1.5.x

 

2.) Keeping all those projects around lengthens the build process and if your 
not using all of them (dspace-sword, lni, etc) thats a lot of compile time for 
nothing.

 

3.) Once configured properly, your changes in dspace/modules/xxx will always be 
separate from the rest of the codebase, but you will still need to verify that 
upgrades don't break your customizations by comparing your code to the 
original.  Something we continue to strive to get away from.

 

So I would recommend the following steps:

 

a.) create a dspace/modules/custom-api/pom.xml for your api changes. That looks 
something like the attached pom.xml

 

 

~~~~~~~~~~~~~

Mark R. Diggory

http://purl.org/net/mdiggory/homepage

 

 

 

 

~~~~~~~~~~~~~

Mark R. Diggory

http://purl.org/net/mdiggory/homepage

 

 

 

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to