Clean up, update pom file

This commit is contained in:
Rubenlagus 2016-05-27 04:43:13 +02:00
parent 1100ad11e4
commit b07bf5531b
3 changed files with 86 additions and 106 deletions

View File

@ -1,7 +1,7 @@
language: java
jdk:
- oraclejdk8
script: mvn versions:display-dependency-updates clean compile assembly:single
script: mvn clean compile package verify
notifications:
webhooks:
secure: "jC7dK/x67ONWQoeLZg4HfW0mHhcjDerJjsLLkrbcpltiqAbw2p7XfY8Pk4zHoD72a+5o6WKu5WvYvZ4OdldnjP8Y6ZUbliQ5RG3olg3gFDoe0+sc3geeb4HRYVcdI20O0z4Bup/qO0ZihxPBc0D5IpHmFxlaqlZG0WeST4CicU8PNnBh6aX9/VMrwXhkMb2vfzmjmIhMbx/uK5+93bnk/vR5Uwu00/Yd2cTAAWMaqK1MRdtR0WLbxlUNsprEfCjYiH3n9XZnlKXs6cLC8EOU436Wx7aepiAszW0wWFMe/7nVqOqztrQiKNvL0qXYwlQf0BLechJdt458EopL9QCu687TNDFYvg1yERAmCRiaayYZcX3PbUSMr6H5Q+Odntjs3XKyzfgSqqlkgf/SAND5jny1/1uteVoplZmFXuZFIiK4H8Rl2ezy1/8pnbp+JD3YEfiA2NuRjlou1BZXyMhiqqVXbrJqk/tXF6yZSkDlYJfNsWzRCGfra4B6JjEvUP927chIFm1ii3dgNstXDo1evV46+OQQO4HKvMPdtU2FPvWpPlkTxnmpZRZjB+bjmybluJdWT3E+e1C3wm7YbRe3vporhpfNPlnod6M0G10y9CKzl9Fbcku6X1FtM+IoPO/aqZ8S4/CBZoYEuR/Nk6bcvsYouxtyIl6PSuF9E8YjpJE="

82
pom.xml
View File

@ -26,6 +26,7 @@
<jerseybundle.version>1.19.1</jerseybundle.version>
<httpcompontents.version>4.5.2</httpcompontents.version>
<json.version>20160212</json.version>
<jackson.version>2.7.4</jackson.version>
</properties>
<dependencyManagement>
@ -44,6 +45,7 @@
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
@ -83,62 +85,32 @@
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin> <!-- Create sources.jar -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<id>clean-project</id>
<phase>clean</phase>
<goals>
<goal>jar</goal>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>org.telegram.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>org.telegram.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
@ -147,27 +119,35 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>copy-dependencies</goal>
<goal>jar-no-fork</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>site</phase>
<goals>
<goal>javadoc-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>

View File

@ -104,7 +104,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter sendMessage can not be null");
}
return (Message) sendApiMethod(sendMessage);
return sendApiMethod(sendMessage);
}
public Boolean answerInlineQuery(AnswerInlineQuery answerInlineQuery) throws TelegramApiException {
@ -112,7 +112,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter answerInlineQuery can not be null");
}
return (Boolean) sendApiMethod(answerInlineQuery);
return sendApiMethod(answerInlineQuery);
}
public Boolean sendChatAction(SendChatAction sendChatAction) throws TelegramApiException {
@ -120,7 +120,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter sendChatAction can not be null");
}
return (Boolean) sendApiMethod(sendChatAction);
return sendApiMethod(sendChatAction);
}
public Message forwardMessage(ForwardMessage forwardMessage) throws TelegramApiException {
@ -128,7 +128,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter forwardMessage can not be null");
}
return (Message) sendApiMethod(forwardMessage);
return sendApiMethod(forwardMessage);
}
public Message sendLocation(SendLocation sendLocation) throws TelegramApiException {
@ -136,7 +136,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter sendLocation can not be null");
}
return (Message) sendApiMethod(sendLocation);
return sendApiMethod(sendLocation);
}
public Message sendVenue(SendVenue sendVenue) throws TelegramApiException {
@ -144,7 +144,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter sendVenue can not be null");
}
return (Message) sendApiMethod(sendVenue);
return sendApiMethod(sendVenue);
}
public Message sendContact(SendContact sendContact) throws TelegramApiException {
@ -152,84 +152,84 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter sendContact can not be null");
}
return (Message) sendApiMethod(sendContact);
return sendApiMethod(sendContact);
}
public Boolean kickMember(KickChatMember kickChatMember) throws TelegramApiException {
if (kickChatMember == null) {
throw new TelegramApiException("Parameter kickChatMember can not be null");
}
return (Boolean) sendApiMethod(kickChatMember);
return sendApiMethod(kickChatMember);
}
public Boolean unbanMember(UnbanChatMember unbanChatMember) throws TelegramApiException {
if (unbanChatMember == null) {
throw new TelegramApiException("Parameter unbanChatMember can not be null");
}
return (Boolean) sendApiMethod(unbanChatMember);
return sendApiMethod(unbanChatMember);
}
public Boolean leaveChat(LeaveChat leaveChat) throws TelegramApiException {
if (leaveChat == null) {
throw new TelegramApiException("Parameter leaveChat can not be null");
}
return (Boolean) sendApiMethod(leaveChat);
return sendApiMethod(leaveChat);
}
public Chat getChat(GetChat getChat) throws TelegramApiException {
if (getChat == null) {
throw new TelegramApiException("Parameter getChat can not be null");
}
return (Chat) sendApiMethod(getChat);
return sendApiMethod(getChat);
}
public List<ChatMember> getChatAdministrators(GetChatAdministrators getChatAdministrators) throws TelegramApiException {
if (getChatAdministrators == null) {
throw new TelegramApiException("Parameter getChatAdministrators can not be null");
}
return (ArrayList<ChatMember>) sendApiMethod(getChatAdministrators);
return sendApiMethod(getChatAdministrators);
}
public ChatMember getChatMember(GetChatMember getChatMember) throws TelegramApiException {
if (getChatMember == null) {
throw new TelegramApiException("Parameter getChatMember can not be null");
}
return (ChatMember) sendApiMethod(getChatMember);
return sendApiMethod(getChatMember);
}
public Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) throws TelegramApiException {
if (getChatMemberCount == null) {
throw new TelegramApiException("Parameter getChatMemberCount can not be null");
}
return (Integer) sendApiMethod(getChatMemberCount);
return sendApiMethod(getChatMemberCount);
}
public Message editMessageText(EditMessageText editMessageText) throws TelegramApiException {
if (editMessageText == null) {
throw new TelegramApiException("Parameter editMessageText can not be null");
}
return (Message) sendApiMethod(editMessageText);
return sendApiMethod(editMessageText);
}
public Message editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
if (editMessageCaption == null) {
throw new TelegramApiException("Parameter editMessageCaption can not be null");
}
return (Message) sendApiMethod(editMessageCaption);
return sendApiMethod(editMessageCaption);
}
public Message editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
if (editMessageReplyMarkup == null) {
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
}
return (Message) sendApiMethod(editMessageReplyMarkup);
return sendApiMethod(editMessageReplyMarkup);
}
public Boolean answerCallbackQuery(AnswerCallbackQuery answerCallbackQuery) throws TelegramApiException {
if (answerCallbackQuery == null) {
throw new TelegramApiException("Parameter answerCallbackQuery can not be null");
}
return (Boolean) sendApiMethod(answerCallbackQuery);
return sendApiMethod(answerCallbackQuery);
}
public UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos) throws TelegramApiException {
@ -237,7 +237,7 @@ public abstract class AbsSender {
throw new TelegramApiException("Parameter getUserProfilePhotos can not be null");
}
return (UserProfilePhotos) sendApiMethod(getUserProfilePhotos);
return sendApiMethod(getUserProfilePhotos);
}
public File getFile(GetFile getFile) throws TelegramApiException{
@ -247,13 +247,13 @@ public abstract class AbsSender {
else if(getFile.getFileId() == null){
throw new TelegramApiException("Attribute file_id in parameter getFile can not be null");
}
return (File) sendApiMethod(getFile);
return sendApiMethod(getFile);
}
public User getMe() throws TelegramApiException {
GetMe getMe = new GetMe();
return (User) sendApiMethod(getMe);
return sendApiMethod(getMe);
}
// Send Requests Async
@ -928,7 +928,7 @@ public abstract class AbsSender {
});
}
private Serializable sendApiMethod(BotApiMethod method) throws TelegramApiException {
private <T extends Serializable> T sendApiMethod(BotApiMethod<T> method) throws TelegramApiException {
String responseContent;
try {
String url = getBaseUrl() + method.getPath();