You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Roman Arkadijovych Muntyanu (JIRA)" <ji...@apache.org> on 2010/07/08 14:46:54 UTC

[jira] Updated: (FILEUPLOAD-183) commons-io dependency does not get loaded by maven if only dependency to commons-fileupload is specified

     [ https://issues.apache.org/jira/browse/FILEUPLOAD-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman Arkadijovych Muntyanu updated FILEUPLOAD-183:
---------------------------------------------------

              Summary: commons-io dependency does not get loaded by maven if only dependency to commons-fileupload is specified  (was: commons-io dependency does ont get loaded by maven if only dependency to commons-fileupload is specified)
    Affects Version/s: 1.2.1
                           (was: 1.2)

> commons-io dependency does not 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.1
>         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.