I'm a "noob" when it comes to Maven. I've used ANT in the past, but not enough Maven to make it "stick" with me.
Here is my problem. I'm attempting to write a java program that will parse JSON files for relevant information and then generate CSV files for upload using a proprietary tool that only uploads CSV files. I built the project using Maven. The program will use the Google Gson library, which I listed as a dependency in my POM file (included below). When I execute "mvn compile", Maven returns an error indicating that the package Maven should be resolving via its dependency management features doesn't exist.
Specific error:
"error: package com.google.code.gson does not exist"
Here is my POM file:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.acumen.app</groupId>
<artifactId>CatalogConverter</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>CatalogConverter</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
I have an import statement in my java application class which should be resolvable based upon Maven downloading my dependencies, if my understanding of Maven is correct. Here is the import statement.
import com.google.code.gson.Gson;
So my question is, why will Maven not compile my code? I don't think I have misconfigured the import nor the POM file. Though, that is always debatable! I can go to my local Maven "repo" and see that the jars were, in fact, downloaded. I'm fairly certain that the error is "user error", so where am I making the mistakes?
I don't believe "provided" is the correct dependency because the jar files are needed for successful compilation and must be downloaded (since no container server or other mechanism will resolve them for me). The application will execute as a jar itself.