Skip to content

Add simple mock code to dev mode #43745

Answered by donkon
t1 asked this question in Q&A
Oct 7, 2024 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

I faced the same problem.

I solved it by compiling / adding the mocks (located in src/test/java) to the classpath by using the build-helper:add-source plugin.

@Alternative
@Priority(1)
@ApplicationScoped
public class MyMock extends MyService {

}

I added following profile to my pom.xml:

<profile>
	<id>dev</id>
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>3.0.0</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/test/java</source>
							</sources…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@t1
Comment options

@aloubyansky
Comment options

@t1
Comment options

Answer selected by t1
Comment options

You must be logged in to vote
2 replies
@aloubyansky
Comment options

@t1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
4 participants