commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Tompkins (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (FILEUPLOAD-183) commons-io dependency does not get loaded by maven if only dependency to commons-fileupload is specified
Date Tue, 06 Jun 2017 04:27:18 GMT

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

Rob Tompkins closed FILEUPLOAD-183.
-----------------------------------

1.3 released.

> 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.2
>         Environment: Maven 2.2.1
>            Reporter: Roman Arkadijovych Muntyanu
>            Assignee: Simone Tripodi
>             Fix For: 1.3
>
>
> 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 was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message