java - Added Gson to the pom.xml but is not found -
java - Added Gson to the pom.xml but is not found -
i have added gson pom.xml. here it. when phone call gson gson = new gson()
, seek search in maven repository doesn't found element. why? wrong?
<?xml version="1.0" encoding="utf-8"?> <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> <parent> <artifactid>volaconnoi_webapp</artifactid> <groupid>it.volaconnoi</groupid> <version>1.0-snapshot</version> </parent> <groupid>it.volaconnoi</groupid> <artifactid>volaconnoi_webapp-ear</artifactid> <version>1.0-snapshot</version> <packaging>ear</packaging> <name>volaconnoi_webapp-ear</name> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-ear-plugin</artifactid> <version>2.8</version> <configuration> <version>6</version> <defaultlibbundledir>lib</defaultlibbundledir> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupid>it.volaconnoi</groupid> <artifactid>volaconnoi_webapp-ejb</artifactid> <version>1.0-snapshot</version> <type>ejb</type> </dependency> <dependency> <groupid>it.volaconnoi</groupid> <artifactid>volaconnoi_webapp-web</artifactid> <version>1.0-snapshot</version> <type>war</type> </dependency> <!-- gson: java json conversion --> <dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.2.4</version> <scope>compile</scope> </dependency> </dependencies> </project>
edit
kindly add together pom.xml file under project tell maven download libraries include in pom file here:
<repositories> <repository> <id>central</id> <name>maven repository</name> <url>http://repo1.maven.org/maven2</url> </repository> </repositories>
and code this:
import com.google.gson.gson; import com.google.gson.gsonbuilder; gson gson = new gsonbuilder().create();
and consult guide on how utilize gson in case need help using too.
java xml maven gson
Comments
Post a Comment