commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Arkadijovych Muntyanu (JIRA)" <j...@apache.org>
Subject [jira] Created: (FILEUPLOAD-183) commons-io dependency does ont get loaded by maven if only dependency to commons-fileupload is specified
Date Thu, 08 Jul 2010 12:46:52 GMT
commons-io dependency does ont get loaded by maven if only dependency to commons-fileupload
is specified
--------------------------------------------------------------------------------------------------------

                 Key: FILEUPLOAD-183
                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-183
             Project: Commons FileUpload
          Issue Type: Bug
    Affects Versions: 1.2
         Environment: Maven 2.2.1
            Reporter: Roman Arkadijovych Muntyanu


If commons-fileupload is added as dependency (without commons-io explicitly defined) like
the following
{code:xml}
<dependency>
  <groupId>commons-fileupload</groupId>
  <artifactId>commons-fileupload</artifactId>
  <version>1.2.1</version>
  <scope>compile</scope>
</dependency>
{code}

and fileupload is referenced in the code like
{code:java}
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);

// Parse the request
List /* FileItem */ items = upload.parseRequest(request);
{code}

then NoClassDefFoundError occurs
{code:none} 
java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
 at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
 at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
 at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
{code}

The reason is that commons-fileupload artifact has *optional* dependency to commons-io in
its pom-file
{code:xml}
<dependency>
  <groupId>commons-io</groupId>
  <artifactId>commons-io</artifactId>
  <version>1.3.2</version>
  <optional>true</optional>
</dependency>
{code}
Which results in commons-io not being downloaded and added to the project by maven.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message