我正在尝试更新Google群组的设置。我有一个Oauth2令牌,但是当我执行以下代码时:
Groupssettings mygs = buildGS();
Groups.Update hisgs = mygs.new Groups().update("11_sp_abd_000_01", gSettings);
hisgs.setOauthToken(token);
hisgs.buildHttpRequest();
hisgs.execute();
public static Groupssettings buildGS()
{
return new Groupssettings.Builder(HTTP_TRANSPORT, JSON_FACTORY, null)
.setApplicationName("ApplicationName")
.build();
}
我收到以下错误:
Exception in thread "main" java.lang.NoSuchMethodError:
com.google.api.services.groupssettings.Groupssettings$Groups$Update.set(Ljava/lang/String;Ljava/lang/Object;)V
at com.google.api.services.groupssettings.Groupssettings$Groups$Update.<init>(Groupssettings.java:363)
at com.google.api.services.groupssettings.Groupssettings$Groups.update(Groupssettings.java:351)
at GetAuth.main(GetAuth.java:62)
答案 0 :(得分:0)
我明白了。很显然,我的POM文件中的定义与我的类路径之间存在Maven冲突。我有两个com.google.api.blah.blah.Groupssettings类的引用,这让Eclipse感到困惑。为了解决我删除了jar文件的类路径引用并离开了POM引用et Viola!