Skip to content

Commit d9d5cb8

Browse files
authored
Merge pull request #948 from jeffgbutler/build-updates
[ci skip] Eclipse Build updates 2 - Fix the Composite Repo Publish
2 parents 8adb2b6 + 20468e1 commit d9d5cb8

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

core/mybatis-generator-maven-plugin/src/main/java/org/mybatis/generator/maven/SqlScriptRunner.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void executeScript() throws MojoExecutionException {
7979

8080
try {
8181
Class<?> driverClass = ObjectFactory.externalClassForName(driver);
82-
Driver theDriver = (Driver) driverClass.newInstance();
82+
Driver theDriver = (Driver) driverClass.getDeclaredConstructor().newInstance();
8383

8484
Properties properties = new Properties();
8585
if (userid != null) {
@@ -114,10 +114,8 @@ public void executeScript() throws MojoExecutionException {
114114
throw new MojoExecutionException("SqlException: " + e.getMessage(), e);
115115
} catch (IOException e) {
116116
throw new MojoExecutionException("IOException: " + e.getMessage(), e);
117-
} catch (InstantiationException e) {
118-
throw new MojoExecutionException("InstantiationException: " + e.getMessage());
119-
} catch (IllegalAccessException e) {
120-
throw new MojoExecutionException("IllegalAccessException: " + e.getMessage());
117+
} catch (ReflectiveOperationException e) {
118+
throw new MojoExecutionException("ReflectiveOperationException: " + e.getMessage());
121119
} finally {
122120
closeConnection(connection);
123121
}

core/mybatis-generator-systests-domtests/src/main/java/mbg/domtest/GenerateTestSourceFiles.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ public static void main (String[] args) {
4848
}
4949
}
5050

51-
private void gatherGenerators(List<CompilationUnitGenerator> generators) throws InstantiationException, IllegalAccessException {
51+
private void gatherGenerators(List<CompilationUnitGenerator> generators) throws ReflectiveOperationException {
5252
Reflections reflections = new Reflections("mbg.domtest.generators");
5353
Set<Class<? extends CompilationUnitGenerator>> classes = reflections.getSubTypesOf(CompilationUnitGenerator.class);
5454

5555
for (Class<? extends CompilationUnitGenerator> clazz : classes) {
5656
if (clazz.getAnnotation(IgnoreDomTest.class) == null) {
57-
generators.add(clazz.newInstance());
57+
generators.add(clazz.getDeclaredConstructor().newInstance());
5858
} else {
5959
System.out.println("Generator " + clazz.getName() + " ignored");
6060
}
6161
}
6262
}
6363

64-
private void run(File outputDirectory) throws IOException, InstantiationException, IllegalAccessException {
64+
private void run(File outputDirectory) throws IOException, ReflectiveOperationException {
6565
setupOutputDirectry(outputDirectory);
6666

6767
List<CompilationUnitGenerator> generators = new ArrayList<>();

eclipse/org.mybatis.generator.eclipse.site/pom.xml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,22 @@
111111
<type>eclipse-feature</type>
112112
</dependency>
113113
<dependency>
114-
<artifactId>org.eclipse.equinox.ds</artifactId>
115-
<type>eclipse-plugin</type>
114+
<artifactId>org.eclipse.equinox.p2.discovery.feature</artifactId>
115+
<type>eclipse-feature</type>
116116
</dependency>
117117
</dependencies>
118-
<applicationsArgs>
119-
<applicationsArg>-application org.eclipse.ant.core.antRunner</applicationsArg>
120-
<applicationsArg>-buildfile updateP2CompositeRepo.ant</applicationsArg>
121-
<applicationsArg>-Dproject.artifactId=${project.artifactId}</applicationsArg>
122-
<applicationsArg>-DqualifiedVersion=${qualifiedVersion}</applicationsArg>
123-
<applicationsArg>-Dproject.build.directory=${project.build.directory}</applicationsArg>
124-
<applicationsArg>-Dp2.repo.base.directory=${p2.repo.base.directory}</applicationsArg>
125-
</applicationsArgs>
118+
<applicationArgs>
119+
<arg>-application</arg>
120+
<arg>org.eclipse.ant.core.antRunner</arg>
121+
<arg>-buildfile</arg>
122+
<arg>updateP2CompositeRepo.ant</arg>
123+
</applicationArgs>
124+
<jvmArgs>
125+
<arg>-Dproject.artifactId=${project.artifactId}</arg>
126+
<arg>-DqualifiedVersion=${qualifiedVersion}</arg>
127+
<arg>-Dproject.build.directory=${project.build.directory}</arg>
128+
<arg>-Dp2.repo.base.directory=${p2.repo.base.directory}</arg>
129+
</jvmArgs>
126130
</configuration>
127131
<executions>
128132
<execution>

eclipse/org.mybatis.generator.eclipse.site/updateP2CompositeRepo.ant

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
by pulling a current copy from jfrog)
3232
3333
-->
34-
<project name="project" default="updateRepo">
34+
<project name="project" default="writeScript">
35+
<condition property="isUnix">
36+
<os family="unix" />
37+
</condition>
38+
3539
<target name="init">
3640
<property name="repo.drops.dir" value="${p2.repo.base.directory}/drops"/>
3741
<property name="repo.zipped.dir" value="${p2.repo.base.directory}/zipped"/>
@@ -78,7 +82,9 @@
7882
<include name="*.xml" />
7983
</fileset>
8084
</replaceregexp>
85+
</target>
8186

87+
<target name="writeScript" depends="updateRepo" if="isUnix">
8288
<!-- setup the shebang and variables -->
8389
<echo message="#!/bin/bash${line.separator}" file="${p2.repo.base.directory}/jfrogUpload.sh" />
8490
<echo message="USER=xxxx${line.separator}" file="${p2.repo.base.directory}/jfrogUpload.sh" append="true" />
@@ -102,6 +108,5 @@
102108

103109
<!-- make it executable -->
104110
<chmod perm="+x" file="${p2.repo.base.directory}/jfrogUpload.sh"/>
105-
106111
</target>
107112
</project>

eclipse/org.mybatis.generator.eclipse.test.utilities/src/org/mybatis/generator/eclipse/test/Utilities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static String getResourceAsString(InputStream resource) throws IOExceptio
6060

6161
public static <T> T newInstance(Class<? extends T> type) {
6262
try {
63-
return type.newInstance();
63+
return type.getDeclaredConstructor().newInstance();
6464
} catch (Exception e) {
6565
throw new CantCreateInstanceException("error creating instance of class " + type.getName(), e);
6666
}

eclipse/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,6 @@
190190
<artifactId>target-platform-configuration</artifactId>
191191
<version>${tycho-version}</version>
192192
<configuration>
193-
<target>
194-
<artifact>
195-
<groupId>org.mybatis.generator</groupId>
196-
<artifactId>org.mybatis.generator.eclipse.target.platform</artifactId>
197-
<version>${project.version}</version>
198-
</artifact>
199-
</target>
200193
<target>
201194
<file>../releng/2021-06.target</file>
202195
</target>

0 commit comments

Comments
 (0)