Er hrm, I'm not sure why this sent again, but ignore it. Question already
answered, thanks!

Matt

On May 30, 2014 at 4:39 PM Matt Whiteman <mwhite...@purelandsupply.com> wrote:
> Hi,
>
>
>
> This has probably been answered before, but I haven't been able to find the
> answer and I'm hoping someone knows.
>
>
>
> I'm writing several apps that talk to a Microsoft SQL database, so I'm using
> the Hibernate dependency. Since Microsoft doesn't make the sqljdbc4 jar
> available on Maven, I've downloaded it, and I'm trying to make it an
> unmanaged dependency in its own standalone project so that I can simply
> reference it in other projects' pom files without having to deploy the jar
> to each one individually.
>
>
>
> I've followed the instructions for deploying an unmanaged dependency. As I
> am the only developer at my company (at this time), I do not have a separate
> Maven server setup. I was hoping to simply deploy the dependency and then
> run 'maven install' so that it copies everything needed into my .m2 folder.
> This is my directory setup:
>
>
>
> (This is the project directory for the sqljdbc4 unmanaged dependency)
>
> C:\dev\Github-repos\addons\sqljdbc4
>
> +- pom.xml
>
> +-src
>
> +-repo
>
>
>
> I followed the instructions to use mvn deploy on the local sqljdbc4.jar
> file. I am using an artifactId of sqljdbc4, version 4.0, groupId of
> com.microsoft.sqlserver. After deployment, the repo directory does appear to
> be correctly populated:
>
>
>
> C:\dev\Github-repos\addons\sqljdbc4
>
> +- pom.xml
>
> +-src
>
> +-repo
>
> +-com
>
> +-microsoft
>
> +-sqlserver
>
> +-sqljdbc4
>
> +-maven-metadata
>
> +-4.0
>
> +-sqljdbc4-4.0.jar
>
> +-sqljdbc4-4.0.pom
>
>
>
> Next, following the instructions, I go back into the pom.xml file and add
> the repository tag, so my pom.xml for this now looks like:
>
>
>
> <project xmlns="http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>
> <modelVersion>4.0.0</modelVersion>
>
> <groupId>com.microsoft.sqlserver</groupId>
>
> <artifactId>sqljdbc4</artifactId>
>
> <version>4.0</version>
>
>
>
> <repositories>
>
> <!--other repositories if any-->
>
> <repository>
>
> <id>project.local</id>
>
> <name>project</name>
>
> <url>file:${project.basedir}/repo</url>
>
> </repository>
>
> </repositories>
>
> </project>
>
>
>
>
>
> Now, here is the problem. Since I want to use this as a dependency in other
> projects, I am trying to run 'maven install' so that it will push everything
> into my .m2 directory. The maven build is a success. However, the resulting
> sqljdbc4.jar file in the target directory and up in the m2 directory is only
> 2kb (whereas the original jar file is 571kb, none of the content made it
> in). As a result, projects that use this as a dependency build, but then
> throw a ClassNotFoundException at runtime, because the classes aren't there.
>
>
>
> I am building a separate project that uses this as a dependency:
>
>
>
> C:\dev\Github-repos\applications\myapp
>
>
>
> The pom.xml for this project uses the dependency correctly:
>
> <dependency>
>
> <groupId>com.microsoft.sqlserver</groupId>
>
> <artifactId>sqljdbc4</artifactId>
>
> <version>4.0</version>
>
> </dependency>
>
>
>
> I'm even using the maven assembly plugin to ensure a jar is built with all
> dependencies packaged in:
>
>
>
> <plugin>
>
>
> <artifactId>maven-assembly-plugin</artifactId>
>
> <configuration>
>
> <descriptorRefs>
>
>
> <descriptorRef>jar-with-dependencies</descriptorRef>
>
> </descriptorRefs>
>
> <archive>
>
> <manifest>
>
> <addClasspath>true</addClasspath>
>
>
> <mainClass>productfeeds.main.ProductFeedDriver</mainClass>
>
> </manifest>
>
> </archive>
>
> </configuration>
>
> <executions>
>
> <execution>
>
> <phase>package</phase>
>
> <goals>
>
> <goal>single</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
>
>
>
>
>
> Any ideas what I'm doing wrong? I'm sure it's something really simple I've
> overlooked. If I don't make this a standalone dependency, and simply use
> 'mvn install:install-file -Dfile=sqljdbc4.jar
> -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0
> -Dpackaging=jar ', then everything works fine.
>
>
>
> Thanks,
>
>
>
> Matt
>
>
>

Reply via email to