2

I am hoping to use MS SQL Server JDBC driver found at Maven.

However, I noticed that mvnrepository.com labels this artifact in test scope, why?

<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>mssql-jdbc</artifactId>
    <version>6.2.2.jre8</version>
    <scope>test</scope>
</dependency>

The definition I found about scope "test" is:

This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.

So I am curious. Why is it labeled as test in scope? Is it ready for production use?

Please go to this Maven page and you will find that each dependency is listed with "test" scope.

https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
curious1
  • 14,155
  • 37
  • 130
  • 231
  • 1
    Where did you find that dependency-definition? You do realise that depedencies are - usually - defined per project, so without context of that project we can't answer. Maybe someone abused it as a provided-scope, maybe you copied it from a project that only uses SQL Server in its tests, etc, etc. – Mark Rotteveel Dec 16 '17 at 09:29
  • Mark, please go to this Maven page and you will find that each dependency is listed with "test" scope https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc – curious1 Dec 16 '17 at 14:53
  • This would have been pertinent information to include in your question. mvnrepository.com is a third party site that crawls maven central, and provides information on artifacts in Maven Central. It provides examples of dependencies, and after sampling a few, they do it for other dependencies too (but not all), including an artifact I maintain and I have no idea why. You should ask the people of mvnrepository.com why they do that. In any case, it has nothing to do with the Microsoft SQL Server JDBC driver specifically. – Mark Rotteveel Dec 17 '17 at 09:44
  • 1
    I have reopened and rephrased your question. I have also sent an email to mvnrepository.com, as I'm curious about this as well. – Mark Rotteveel Dec 17 '17 at 10:02
  • 1
    My guess is that it decides that based on usage statistics. More open-source projects probably use it as a test dependency than as a runtime dependency (because they're connection pools, or database-agnostic management tools that are tested against the ms driver). Many projects probably use it as a runtime dependency, but most of them probably are not open source, and thus not in Maven Central. – JB Nizet Dec 17 '17 at 10:12
  • Mark, thanks for rewording my question and contact mvnrepository.com. I found this link, it seems the drivers listed there should NOT be scoped as "test". These drivers are for production use. Am I right? https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server – curious1 Dec 17 '17 at 15:54
  • 2
    Unfortunately I haven't received a reply, but I think JB Nizet's theory is very likely: mvnrepository.com might use statistics of the usage of a dependency in other indexed projects as indication how it is to be used. And it looks like most projects on Maven Central only use the SQL Server JDBC driver as a test dependency. – Mark Rotteveel Jan 10 '18 at 14:42
  • Thanks for the info! Found out this link. Hope it is helpful. https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server – curious1 Jan 11 '18 at 02:56

0 Answers0