XChart
XChart copied to clipboard
Split the xchart project
Hi. We would like to use XChart in our software. We have our own Graphics2D implementations producing different target formats and the goal is to let XChart draw a chart upon our Graphics2D. Looking at the core xchart project, it has unnecessary dependencies which are only needed to produce PDF, GIF and the like or to implement a simple Swing application using XChart. Third party dependencies are evil for various reasons. They can bring version conflicts in case some of them is already used elsewhere in the software (as with PDFBox in our case). If not used, they blow up the application unnecessarily, etc. Manually excluding the dependencies is not an option as some application servers validate the deployment to make sure that all imports in all classes can be satisfied, even if the given class is never used in the application.
Would you consider splitting xchart into xchart-core (only the core functionality) and xchart-app (containing BitmapEncoder, GifEncoder, PdfboxGraphicsEncoder, SwingWrapper, VectorGraphicsEncoder, XChartPanel and a few other classes which are only needed by those mentioned above). The original xchart project would just contain a dependency to the other two then. (SVN patch included) splitproject.zip
@PetrSlaby After uncompressing splitproject.zip, I can't see all the codes. Please upload all the codes and show the whole project ,to help you analyze this problem. Thank you. @timmolter Please help see if this plan is feasible.Thank you.
XChart.zip Attaching the complete project. The goal is simply to have a core part (xchart-core in my proposal) of the library without any dependencies, containing just the core functionality and not dealing with GIFs and the like. In the proposal, I have moved the non-core stuff to xchart-app, but that is probably not necessary. These classes might remain in project xchart, so the structure would be project xchart-core containing just the core functionality and project xchart depending on xchart-core, providing the additional stuff like export to various formats.
For users using maven, the change would not be a problem. Users which setup the classpath manually would have to add the new xchart-core library to it..
Those dependencies you've mention are marked as optional in the parent pom:
<dependency>
<groupId>de.erichseifert.vectorgraphics2d</groupId>
<artifactId>VectorGraphics2D</artifactId>
<version>0.13</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>de.rototor.pdfbox</groupId>
<artifactId>graphics2d</artifactId>
<version>0.27</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>animated-gif-lib</artifactId>
<version>1.4</version>
<optional>true</optional>
</dependency>
That means that your app needs to explicitly define them in your app's pom in order for maven to add them to the classpath. So, no, I don't see the need to split the project.
OK, thanks. I understand that splitting the library is some work and you do not see the benefits of doing it. I will find a way to workaround it.