Sendgrid Java在Maven中不工作

Sendgrid Java在Maven中不工作,java,api,maven,sendgrid,Java,Api,Maven,Sendgrid,我正在我的应用程序中使用。当我尝试运行sendgridexample.java时,它会导致错误InvocationTargetException,根本原因是 java.lang.NoClassDefFoundError:org/apache/http/impl/client/HttpClientBuilder sendgrid.sendgrid.(sendgrid.java:80) 我正在使用maven。有人在maven试过这个吗。我试图联系sendgrid支持团队,但仍然没有得到任何关于此的更

我正在我的应用程序中使用。当我尝试运行sendgridexample.java时,它会导致错误InvocationTargetException,根本原因是

java.lang.NoClassDefFoundError:org/apache/http/impl/client/HttpClientBuilder
sendgrid.sendgrid.(sendgrid.java:80)
我正在使用maven。有人在maven试过这个吗。我试图联系sendgrid支持团队,但仍然没有得到任何关于此的更新。有人能说出我的代码有什么问题吗。提前谢谢

SendGrid sendgrid = new SendGrid("API_KEY");
SendGrid.Email email = new SendGrid.Email();

email.addTo("user@domain.com");
email.setFrom("otheruser@domain.com");
email.setSubject("Hello World");
email.setText("My first email with SendGrid Java!");

try {
  SendGrid.Response response = sendgrid.send(email);
  System.out.println(response.getMessage());
}
catch (SendGridException e) {
  System.err.println(e);
}

是的,我找到了解决办法。去。复制两个java文件[SendGrid.java和SendGridException.java],在应用程序中创建一个文件夹com.SendGrid,并将这两个java文件粘贴到该文件夹中。那就去。复制这两个java文件的所有依赖项,并粘贴到pom.xml文件中。很好。

嗨,你找到解决办法了吗?这是一个Android项目吗?我这里也有类似的问题…谢谢!