Spring Boot App with Maven and Wildly (26.1.1) - PAGE NOT FOUND Error - spring

I have created a Spring Boot application. I use WildFly as the application server - this is what I want to use to run the application.
These are the Java and Maven related files I have:
#RestController
public class MyController {
#Autowired
private Student student;
#GetMapping(value="/index")
public String sayHello() {
return "Hello";
}
}
Of course I have the main method with the Spring Boot related annotations:
#SpringBootApplication
public class SpringBootTestApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootTestApplication.class, args);
}
}
I have the Maven file like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.globalsoftwaresupport</groupId>
<artifactId>spring-boot-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot-test</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
<deploy.jboss.host>127.0.0.1</deploy.jboss.host>
<deploy.jboss.port>9990</deploy.jboss.port>
<deploy.jboss.username>balazs</deploy.jboss.username>
<deploy.jboss.password>balazs1990</deploy.jboss.password>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>2.0.2.Final</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<filename>${project.build.finalName}.war</filename>
<hostname>${deploy.jboss.host}</hostname>
<port>${deploy.jboss.port}</port>
<username>${deploy.jboss.username}</username>
<password>${deploy.jboss.password}</password>
</configuration>
</plugin>
</plugins>
</build>
<packaging>war</packaging>
When I build the project with mvn clean install then Maven compiles and deployed the app to the Wildfly server.
So far so good I have the application on the server. First of all:
1.) is it not a problem that I have the SNAPSHOT present in the context root?
2.) another problem is that I can not run the application - I start WildFly server in Eclipse and I check the context root.
Can you help me why is this happening? Thank you for your help in advance!

Related

RestController works fine in SpringBoot, but throws 404 on Tomcat

I have a simple RestController application -
#RestController
public class GreetingController {
private static final Logger logger = LogManager.getLogger(GreetingController.class);
#RequestMapping("/greeting")
public ResponseEntity<GreetingResponse> greeting(#RequestParam(value = "name", defaultValue = "World") String name) throws ServiceException, Exception {
logger.info("Received Request. Name: " + name);
It works fine on SpringBoot (http://localhost:8080/greeting), but when I create a WAR and deploy it on Tomcat (9.0.2), it throws a 404.
Application is deployed fine and I can hit a static HTML page in the application, so my context path is correct.
What could I be missing?
Here is my gradle tasks -
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('com.jayway.jsonpath:json-path')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.10.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.10.0'
}
war {
archiveName = "ROOT.war"
manifest {attributes "Implementation-Version": "${version}"}
}
I have zip of my whole application here, if anyone is curious.
Found the issue. My application had to extend SpringBootServletInitializer
#SpringBootApplication
public class Application extends SpringBootServletInitializer {
Your answer is correct, I just wanted to add on it, that if you have the requirement where you need to create a war file for your application and deploy it on an external app server like Tomcat or IBM Liberty, it is is best you disable the inbuilt tomcat starter when deploying it in external App servers. This can be done via using profiles tag in your POM file and using the exclusion tag to specify that you do not need "spring-boot-starter-tomcat"
Our POM looks like this
<groupId>com.anz.tpp</groupId>
<artifactId>example-project</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>Example Project</name>
<!-- Versions -->
<properties>
<apache.camel.version>X.X.X</apache.camel.version>
<junit.version>X.X</junit.version>
</properties>
<!-- Spring Boot Parent -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
<relativePath />
</parent>
<profiles>
<profile>
<id>dev</id>
<properties>
<activatedProperties>dev</activatedProperties>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<properties>
<activatedProperties>local</activatedProperties>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
.......
</profile>
</profiles>
Not sure if this is really a concern at your end, but it is best to operate under two profiles where you use one profile to run your project through an IDE like intelliJ or Eclipse and other way, you can use the dev profile to build your package by specifying "mvn clean install -U -P dev" to deploy the war file in an external appserver like tomcat or IBM Liberty.
My apologies if you have already figured it out, just that this helped me during my starting stages of my spring-boot project. Hope this helps!

No schemas have been found - Spring Boot WS

I have the next throuble:
When I follow the Spring boot WS example with maven, when I follow the steps, after add the xsd file, the guide indicate how to add the plugin to pom.xml file and this automatically turn the xsd file into java class objects. But I've received this:
No schemas have been found (org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc:xjc:generate-sources)
org.apache.maven.plugin.MojoExecutionException: No schemas have been found
at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:376)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
...
Here is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tester</groupId>
<artifactId>test-ws</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<name>test-ws</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
</plugins>
</build>
This is a screenshot how is look like the error:
Any help is appreciated!
Ok, if someone has the same error, I got the solution like this:
First, I configured the maven user settings in eclipse by adding a separate repository folder for the related project (Override the default path located in X:\Users\User.m2\repository).
I removed two custom profiles that I had in the previous file.
I updated the project and magically, the error disappeared.
Thanks to all for the help.

Custom maven plugin fails when mojo extends mojo from different module (no AbstractMojo)

I have mutli project with 2 maven plugin modules: base and child (<packaging>maven-plugin</packaging>). Child depend on base.
Base plugin has single class:
public abstract class BaseMojo extends AbstractMojo {}
with POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>plugin-set</groupId>
<artifactId>plugin-set</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>plugin-base</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
<configuration>
<goalPrefix>my</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Child plugin has single class:
public abstract class ChildMojo extends BaseMojo {}
with POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>plugin-set</groupId>
<artifactId>plugin-set</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>plugin-child</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>plugin-set</groupId>
<artifactId>plugin-base</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
<configuration>
<goalPrefix>my-child</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Base compiles correctly, child pass compilation but fails maven-plugin-plugin:3.4:descriptor:
Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor (default-descriptor) on project plugin-child: The API of the mojo scanner is not compatible with this plugin version. Please check the plugin dependencies configured in the POM and ensure the versions match. org/apache/maven/plugin/AbstractMojo: org.apache.maven.plugin.AbstractMojo -> [Help 1]
How to build child module?
Both base and child has almost identical pom.xml, child has 1 more dependency: to base
Source: https://github.com/michaldo/mojo-extend-mojo
The direct solution to your compilation issue is to remove <scope>provided</scope> from the maven-core dependency in plugin-child.
However, although it will compile after that, there are a lot of changes to be made to your project for it to work.
You should have a clear view of what a Mojo is and how it is implemented.
First of all, a Mojo should comply to a simple contract, which is implementing the Mojo interface.
Although the requirements on Mojos are minimal by design, there are still a very few requirements that Mojo developers must keep in mind. Basically, these Mojo requirements are embodied by the org.apache.maven.plugin.Mojo interface, which the Mojo must implement (or else extend its abstract base class counterpart org.apache.maven.plugin.AbstractMojo).
You can have a hierarchy of abstract classes but the top-most abstract one should inherit from AbstractMojo (or implement Mojo). Having a common abstract parent class is not uncommon. It is done by a lot of standard Maven plugins, like the maven-install-plugin.
What is important to note that the abstract classes are simply there to factor common code from multiple Mojo in a plugin. They do not represent a goal. As such, the plugin-base module, which contains your abstract superclass:
should not be packaged as a maven-plugin.
should not declare an execution of the maven-plugin-plugin plugin.
The concrete Mojo is inside plugin-child so it is this module that should be packaged as a maven-plugin. Since this will be the concrete implementation, it must not be abstract and it can be annotated with #Mojo to ease its declaration:
#Mojo(name = "child")
public class ChildMojo extends BaseMojo {
#Override
public void execute() throws MojoExecutionException, MojoFailureException {
}
}
This declares the goal "child" for this Mojo.
Sample code
plugin-base
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>plugin-set</groupId>
<artifactId>plugin-set</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>plugin-base</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>
</project>
with the only class being
import org.apache.maven.plugin.AbstractMojo;
public abstract class BaseMojo extends AbstractMojo { }
plugin-child
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>plugin-set</groupId>
<artifactId>plugin-set</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>plugin-child</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>plugin-set</groupId>
<artifactId>plugin-base</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
<configuration>
<goalPrefix>my-child</goalPrefix>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
with the following Java code:
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
#Mojo(name = "child")
public class ChildMojo extends BaseMojo {
#Override
public void execute() throws MojoExecutionException, MojoFailureException {
}
}
Finally, you can test that this works by depending on this plugin:
<plugin>
<groupId>plugin-set</groupId>
<artifactId>plugin-child</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>foo</id>
<goals>
<goal>child</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
</plugin>
If you build the test project depending on plugin-child then you will correctly see Maven invoking it, on the install phase here.

SpringBootServletInitializer not working on tomcat server

I'm trying to run my Spring Boot application on a local Tomcat 8 server, but can't get it to run. It works fine in Eclipse and mvn spring-boot:run.
I added the SpringBootServletInitializer and changed the pom.xml as recommended. But it seems that it never runs.
Here is the main class:
#SpringBootApplication
public class SasuApplication extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SasuApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(SasuApplication.class, args);
}
}
And here is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sverin.poc</groupId>
<artifactId>sasu</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>sasu</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>sasu</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
What am I missing?
Old question I know, but I just had this problem with Spring Boot 2.0.3 and Tomcat 8.5. My solution was to remove the <absolute-ordering> element from my web.xml file.
Another reason could be Tomcat version.
Spring boot does not work with Tomcat 10 #22414
Perhaps the problem is in the Java version and environment variables...
check JRE_HOME, after I set to 1.8 it started working

Maven, JUnit and Dagger - Dagger module could not be loaded

Note: I am building/testing via command line only.
I am running into an issue using Dagger, and have been able to reproduce the same issue in a very small test project. When trying to use Dagger in a unit test, I get the following error while running 'mvn clean test':
sanity(com.mycompany.app.AppTest): Module adapter for class com.mycompany.app.AppTest$TestModule could not be loaded. Please ensure that code generation was run for this module.
In the application, Dagger is compiling/building just fine, and injection is working great. The only issue is with the unit tests, and I feel that the unit tests arent picking up the results from the dagger-compiler, but am not sure how to test/fix this.
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>my-app</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
AppTest.java
package com.audible.hushpuppy.dagger;
import org.junit.Before;
import org.junit.Test;
import dagger.Module;
import dagger.ObjectGraph;
import static org.junit.Assert.assertNull;
public class AppTest {
#Module(injects = AppTest.class)
public class TestModule{
}
#Before
public void setUp() throws Exception {
ObjectGraph.create(new TestModule());
}
#Test
public void sanity() throws Exception {
assertNull(null);
}
}
Aha - apparently annotation processing was completely turned off in an earlier commit, and I completely missed this line in the pom:
<compilerArgument>-proc:none</compilerArgument>

Resources