Skip to content

Commit 81c20c7

Browse files
committed
Default Root Package
1 parent 78325bb commit 81c20c7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/main/java/org/sqlcomponents/SQLComponentsMojo.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
/**
2020
* The type Sql components mojo.
2121
*/
22-
@Mojo(name = SQLComponentsMojo.GENERATED_SOURCES, defaultPhase =
23-
LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution =
24-
ResolutionScope.RUNTIME)
22+
@Mojo(name = "generate",
23+
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
24+
requiresDependencyResolution = ResolutionScope.RUNTIME)
2525
public final class SQLComponentsMojo extends AbstractMojo {
2626
/**
2727
* The Generated sources.
@@ -73,6 +73,12 @@ public void execute() {
7373
Application lApplication = null;
7474
try {
7575
lApplication = createApplicationFromYMLSpec();
76+
if(lApplication.getRootPackage() == null
77+
|| lApplication.getRootPackage().trim().isEmpty() ) {
78+
lApplication.setRootPackage(this.project.getGroupId() + "."
79+
+ this.project.getArtifactId());
80+
}
81+
7682
lApplication.getOrm()
7783
.setApplicationClassLoader(getClassLoader(this.project));
7884
lApplication.compile(
@@ -93,7 +99,7 @@ public void execute() {
9399
*/
94100
private ClassLoader getClassLoader(final MavenProject paramProject) {
95101
try {
96-
List classpathElements = paramProject.getCompileClasspathElements();
102+
List<Object> classpathElements = paramProject.getCompileClasspathElements();
97103
classpathElements.add(paramProject.getBuild().getOutputDirectory());
98104
classpathElements.add(
99105
paramProject.getBuild().getTestOutputDirectory());
@@ -121,7 +127,7 @@ private Application createApplicationFromYMLSpec() throws IOException {
121127
lApplication.setSrcFolder(
122128
project.getBuild().getDirectory() + GENERATE_SOURCES_DIR
123129
+ lApplication.getName().toLowerCase());
124-
getLog().info("'" + GENERATED_SOURCES + "' directory is: "
130+
getLog().info("'SQL Components' are created at: "
125131
+ lApplication.getSrcFolder());
126132
project.addCompileSourceRoot(lApplication.getSrcFolder());
127133
return lApplication;

0 commit comments

Comments
 (0)