On Tue, 10 Dec 2002 02:22, Tom wrote:
> Why are things such as SAR and BAR files?   I know they are just Java
> Archive files, but it makes working with Avalon/Phoenix/James, etc. a
> pain with an IDE because they only (AFAIK with IDEA) only recognize .JAR
> files.

Hi Tom,

There's no need to rename any files when using IDEA (v3.0). Just do this:
1) Options->IDE Settings
2) Click on FileTypes
3) Add "sar" as a registered extension for the "Archive Files" file type.

This way, you can see the sar files in your project view. In IDEA 2.0 I don't 
think it's possible, but I don't think you could see jar files, either.

You shouldn't need to add the sar file to your classpath. Instead, you need to 
add the individual jar files separately (see Danny's email for debugging in 
eclipse).

>
> After figuring this out, I ended up just making copies of the BAR, SAR
> files and giving them JAR extensions (so the IDEA compiler wouldn't
> complain).

The compiler has no need to know about the sar file. I've got no idea why IDEA 
would need to see it, and thus complain.

I never compile from my ide, but use Ant instead. Add build.xml to the list of 
build files in the Ant tab, and execute the "main" target. This will compile 
everything, and bundle it into a distribution ready to roll.

>From there, the easiest way to build your custom mailet is to just add it into 
the org.apache.james.transport.mailets package. (NOTE: this is NOT a proper 
solution, but will get you up and running quickly). 

Here's a quick step-through that might help.
1) Check out James from cvs
2) Create a james project in IDEA - you *don't* need to set the compiler 
output path.
3) Add src/java to the sourcepath.
4) Add all of the jar files in lib and in phoenix-bin/lib to your classpath.
5) Add build.xml to your ant files
6) Execute the "main" target of build.xml
7) You now have a working ant distribution in "dist". Try it out and see if it 
works. Add a user. Configure your mail client to use localhost:25 for SMTP. 
Send an email to "user@localhost". Add a POP3 account to your email client 
using localhost:110. Make sure you can fetch the mail you sent.

8) OK, now you've got a working copy of james. Time to add your mailet.
9) Add a new package to src/java. Let's call it "mymailets".
10) Add a new class: "mymailets/SimpleMailet" - make this class extend 
org.apache.mailet.GenericMailet.
11) important: Modify "build.xml" - "sar" target to look like this
    <target name="sar" depends="prepare,compile">
        ... stuff ...
        <jar jarfile=....>
            <include name="org/apache/james/**"/>
            <include name="org/apache/mailet/**"/>
            <include name="mymailets/**"/> <!-- This is the new line -->
        </jar>
        <!-- Make sar file-->
This will make sure that your new classes are included with the build.
12) Run the "main" target again - test James. Nothing should have changed.
13) Modify dist/james-2.1-cvs/apps/james/SAR-INF/config.xml (spoolmanager 
element) to use your mailet. You'll need to do this:
      <!-- Set the Java packages from which to load mailets and matchers -->
      <mailetpackages>
         <mailetpackage>org.apache.james.transport.mailets</mailetpackage>
         <!-- This is the new line -->
         <mailetpackage>mymailets</mailetpackage>
      </mailetpackages>
And this:
<processor name="transport">
        <mailet match="[EMAIL PROTECTED]" mailet="SimpleMailet"/>
        ...

14) Restart james - you should see your mailet in action. 

Note: I suggest a very simple mailet for starters. Try modifying the subject 
line or something similar. This will give you the positive feedback to move 
forward.

I hope this helps. Please keep asking questions, but please be specific about 
what you're doing and why. I use IDEA, too, so maybe I'll play around with 
debugging the Phoenix source. But try this simple example, and I think you'll 
start to understand a bit more.

Also, you might want to read:
http://jakarta.apache.org/site/idedevelopers.html
It's got some useful tips.

Hope this helps,
ciao
Daz


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

Reply via email to