java - maven build error: package org.apache.http does not exist -


i attempting send simple http post java program (for deploying on heroku). started demo project here. using mvn package builds project successfully.

i added own additional file testpost.java few lines of code, added pom.xml, , still built fine.

then tried add http code this example (minus package line), uses apache httpclient library.

using mvn package results in following error:

package org.apache.http not exist  

after searching solutions tried including dependency in pom.xml:

<dependencies>     <dependency>         <groupid>org.apache.httpcomponents</groupid>         <artifactid>httpclient</artifactid>         <version>4.5.2</version>         <scope>compile</scope>     </dependency> </dependencies> 

my understanding should force download of necessary package no download shown on next compile (just same error), , package not visible in user .m2\repository\ folder.

i tried inserting dependency @ different points in pom.xml without success.

why apache library not being downloaded? please note new maven.

here pom.xml should have if indeed need depend on httpclient.

<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>demo</groupid>     <artifactid>httpclient-demo</artifactid>     <version>1.0-snapshot</version>     <packaging>jar</packaging>      <name>httpclient-demo</name>     <url>http://maven.apache.org</url>      <properties>         <project.build.sourceencoding>utf-8</project.build.sourceencoding>     </properties>      <dependencies>         <dependency>             <groupid>org.apache.httpcomponents</groupid>             <artifactid>httpclient</artifactid>             <version>4.5.2</version>         </dependency>     </dependencies> </project> 

now if put java sources in src/main/java, src , pom.xml in same directory, maven should resolve dependency local repository, , download it, should not there. local repository defined in conf/settings.xml in maven installation directory.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -