4

Trying to use the Apache Mime4J dependency for Version 0.7.2 like this:

<repositories>
  <repository>
    <id>org.apache.james</id>
    <url>http://repo1.maven.org/maven2/</url>
  </repository>
</repositories>

<dependency>
  <groupId>org.apache.james</groupId>
  <artifactId>apache-mime4j</artifactId>
  <version>0.7.2</version>
</dependency>

I got an error message that the dependency could not be downloaded. After checking that http://uk.maven.org/maven2/org/apache/james/apache-mime4j/0.7.2/apache-mime4j-0.7.2.jar indeed does not exist but http://uk.maven.org/maven2/org/apache/james/apache-mime4j/0.7.2/ had .bin.tar.gz files I worked around the problem using:

<dependency>
   <groupId>org.apache.james</groupId>
   <artifactId>apache-mime4j</artifactId>
   <version>0.6.1</version>
</dependency>

This will therefore not reference the more current 0.7.2 release.

This is my "set of questions":

  • Why does the 0.7.2 release not contain a Jar file?
  • How should I reference the dependency to get the latest Jar?
  • Do I need it anyway?
  • What differences are there between the 0.7.2 and the 0.6.1 release?
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
  • http://uk.maven.org/maven2/org/apache/james/apache-mime4j-core/0.7.2/ has one of the necessary jars as per the changelog mentioned in the edited answer below. – Wolfgang Fahl Feb 25 '13 at 18:11

1 Answers1

6

Question 1: Why an artifact might not exist

According to the changelog there has been some refactoring going on to split the functionality into the three parts: core,dom and storage.

Question 2: How to get the latest artifact

modify the dependencies to:

 <dependency>
   <groupId>org.apache.james</groupId>
   <artifactId>apache-mime4j-core</artifactId>
   <version>0.7.2</version>
 </dependency>
 <dependency>
   <groupId>org.apache.james</groupId>
   <artifactId>apache-mime4j-dom</artifactId>
   <version>0.7.2</version>
 </dependency>
    <dependency>
    <groupId>org.apache.james</groupId>
    <artifactId>apache-mime4j-storage</artifactId>
    <version>0.7.2</version>
  </dependency>

Question 3: Do I need it?

if you'd like to use the improved DOM API: yes. You will need to modify your import statements and can not use new Message() any more. Use

MessageServiceFactory.newInstance().newMessageBuilder().newMessage();

instead. The multipart.getBodyParts() function has also changed and returns an Entity now. There is no isMimeType() for the Entity. You might want to use getMimeType() instead.

Question 4: What changed between versions?

See the change log between 0.7.2 and 0.6.1.

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
  • January 2012 - Apache James Mime4j 0.7.2 released thanx for the quick shot. This is what I found regarding the changes so far "The Java Apache Mail Enterprise Server (a.k.a. Apache James) Project is happy to announce the release of version 0.7.2 of Apache James Mime4j library. ..." – Wolfgang Fahl Feb 25 '13 at 17:04
  • Not sure I follow, did my answer help you? –  Feb 25 '13 at 17:07
  • you might want to edit your answer a bit based on the 0.7 changelog - it looks like the main mime4jar has been split. – Wolfgang Fahl Feb 25 '13 at 18:09
  • Perfect! I agree that it looks much better :) –  Feb 25 '13 at 18:38