Tag Archives: maven

how to add sqljdbc_auth.dll to my maven project

Questions: I am trying to establish connection to database. It’s a simple project with using maven. I have problems with sqljdbc_auth.dll I have added mssql jdbc driver and added a dependency in pom.xml <dependency> <groupId>com.microsoft</groupId> <artifactId>mssql-jdbc</artifactId> <version>4.0.0</version> </dependency> This is my try block try { // Establish the connection. SQLServerDataSource ds = new SQLServerDataSource(); ds.setIntegratedSecurity(true);… Read More »

Maven: How to change path to target directory from command line?

Questions: Maven: How to change path to target directory from command line? (I want to use another target directory in some cases) Answers: You should use profiles. <profiles> <profile> <id>otherOutputDir</id> <build> <directory>yourDirectory</directory> </build> </profile> </profiles> And start maven with your profile mvn compile -PotherOutputDir If you really want to define your directory from the command… Read More »

How to add an extra source directory for maven to compile and include in the build jar?

Questions: In addition to the src/main/java, I am adding a src/bootstrap directory that I want to include in my build process, in other words, I want maven to compile and include the sources there in my build. How!? Answers: You can use the Build Helper Plugin, e.g: <project> … <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.7</version>… Read More »

What does Maven Update Project do in Eclipse?

Questions: What does “Maven -> Update Project…” do in Eclipse? Answers: It syncs the Eclipse project settings with that of the pom. If you for example change important plugin settings, such as the output java version, you will find that Eclipse will ask you to update the project and afterwards the configured Java runtime in… Read More »

How do I add a Maven dependency in Eclipse?

Questions: I don’t know how to use Maven at all. I’ve been developing for a couple years with Eclipse and haven’t yet needed to know about it. However, now I’m looking at some docs that suggest I do the following: “To include it within your project, just add this maven dependency to your build.” <repository>… Read More »

Specify JDK for Maven to use

Questions: I am trying to build a Hudson plugin I’ve modified and it requires jdk1.6. This is fine, but I don’t see how I can tell maven where the different jdk is. I’ve found few mentions on the internet but they don’t seem to apply to me. Some suggest adding some config to .m2/settings.xml but… Read More »

Building a runnable jar with Maven 2

Questions: I’m relatively new to the Maven mantra, but I’m trying to build a command-line runnable jar with Maven. I’ve setup my dependencies, but when I run mvn install and attempt to run the jar, two things happen. First, no main class is found, which is correctable. When I’ve corrected this, I get errors on… Read More »

Why Maven uses JDK 1.6 but my java -version is 1.7

Questions: I’m new to maven, and also to MacOS. I have setup maven in my terminal, and when getting the version settings (using mvn -v) it seems it uses JDK 1.6, while I have JDK 1.7 installed. Is there anything wrong? The commands I enter are these: blues:helloworld Ninja$ java -version java version “1.7.0_05” Java(TM)… Read More »

Add a dependency in Maven

Questions: How do I take a jar file that I have and add it to the dependency system in maven 2? I will be the maintainer of this dependency and my code needs this jar in the class path so that it will compile. Answers: You’ll have to do this in two steps: 1. Give… Read More »