Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

Java client for Twingly Search API (previously known as Twingly Analytics API). Twingly is a blog search service that provides a searchable API known as [Twingly Search API](https://developer.twingly.com/resources/search/).

## Installation

Get the latest release from [Maven Central](https://search.maven.org/#search%7Cga%7C1%7Ctwingly-search).

## Usage

```Java

import com.twingly.search.*;
public class Test{
public static void main(String[] args){
Expand All @@ -27,8 +30,8 @@ public class Test{
}
}
}

```

A Query object can be reused for several requests.

To learn more about the features of this client, check out the example code that can be found in [example](example).
Expand Down Expand Up @@ -118,6 +121,17 @@ gradlew generateOneJar

This will save JAR file with all needed dependencies in `build/libs/` with `-all` suffix. (like `twingly-search-api-java-all-0.0.1.jar`)

### Release

Before you start, ensure that you have a properly setup `~/.gradle/gradle.properties` ([see the example](http://central.sonatype.org/pages/gradle.html#credentials)) and [GPG](https://www.gnupg.org/) keyring (`brew install gpg`, get the secret key from our secret stash, `gpg --import <path to key>`).

1. Ensure you are using Java 7
1. Bump the version in [version.properties](./src/main/resources/version.properties)
1. Run `gradlew uploadArchives -Prelease` to release to the staging repository
1. Log into [Nexus Repository Manager](https://oss.sonatype.org/) and find the archive
1. Read [Releasing the Deployment](http://central.sonatype.org/pages/releasing-the-deployment.html)
1. Release to Central Repository using [Nexus Repository Manager](https://oss.sonatype.org/)

## License

The MIT License (MIT)
Expand Down
69 changes: 66 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ apply plugin: "maven"
apply plugin: "signing"
apply plugin: "jacoco"

group = "com.twingly"

ext {
versionProperties = new Properties()
versionProperties.load(file("src/main/resources/version.properties").newReader())
Expand Down Expand Up @@ -35,16 +33,25 @@ ext {
)
}
}

group = "com.twingly"
version = ext.projectVersion
sourceCompatibility = 1.7
targetCompatibility = 1.7

def isReleaseBuild
if(hasProperty("release")) {
isReleaseBuild = true
} else {
isReleaseBuild = false
}

repositories {
mavenCentral()
jcenter()
mavenLocal()
}

dependencies {
compile libs.jaxb
testCompile libs.junit
Expand Down Expand Up @@ -82,6 +89,7 @@ javadoc {
options.memberLevel = JavadocMemberLevel.PROTECTED
classpath = configurations.compile
}

//create a single Jar with all dependencies
task generateOneJar(type: Jar) {
baseName = project.name + '-all'
Expand Down Expand Up @@ -114,7 +122,62 @@ tasks.withType(JavaCompile.class) {

artifacts {
archives jar

archives javadocJar
archives sourcesJar
}

if(isReleaseBuild) {
signing {
sign configurations.archives
}
} else {
task signArchives {
// do nothing
}
}

uploadArchives {
repositories {
if (!isReleaseBuild) {
mavenLocal()
}
else {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}

pom.project {
name "twingly-search"
packaging "jar"
description "Client for Twingly Search API."
url "https://developer.twingly.com/resources/search/"

scm {
connection "scm:[email protected]:twingly/twingly-search-api-java.git"
developerConnection "scm:[email protected]:twingly/twingly-search-api-java.git"
url "scm:[email protected]:twingly/twingly-search-api-java.git"
}

licenses {
license {
name "MIT License"
url "http://www.opensource.org/licenses/mit-license.php"
distribution "repo"
}
}

developers {
developer {
id "twingly"
name "Twingly AB"
email "[email protected]"
}
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rootProject.name = "twingly-search-api-java"
rootProject.name = "twingly-search"

include 'example'
include 'example'