Skip to content

Instantly share code, notes, and snippets.

View sobvan's full-sized avatar

sobvan sobvan

View GitHub Profile
@sobvan
sobvan / JavaAptPlugin.groovy
Last active August 20, 2019 13:31 — forked from nobuoka/JavaAptPlugin.groovy
Java Annotation Processing Task for Gradle forked from https://gist.github.com/nobuoka/7614981, fixed for Gradle 4.2 compatilbity, missing imports in JavaAptPlugin.groovy added, option to skip metadataGeneration for a subproject in a multi-project build added.
// buildSrc/src/main/groovy/JavaAptPlugin.groovy
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.internal.file.CompositeFileTree
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.compile.JavaCompile
class JavaAPT extends DefaultTask {
@sobvan
sobvan / Log4jToConsoleTest.java
Last active June 14, 2016 15:43
Simple code to initialize Log4j to only log to console. Useful in unit tests where you have log4j dependency in your code.
package com.inepex.gist;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.junit.Test;
public class Log4jToConsoleTest {
@Test
public void testRead() throws IOException {