Skip to content

Commit 8c195cc

Browse files
committed
🎨 调整代码生成插件支持新版本ssh-agent
1 parent 7b959ed commit 8c195cc

File tree

3 files changed

+13
-3
lines changed
  • api-boot-project

3 files changed

+13
-3
lines changed

Diff for: api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<dependency>
7676
<groupId>org.minbox.framework</groupId>
7777
<artifactId>ssh-agent</artifactId>
78+
<version>${ssh-agent.version}</version>
7879
<optional>true</optional>
7980
</dependency>
8081
</dependencies>

Diff for: api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/src/main/java/org/minbox/framework/api/boot/maven/plugin/mybatis/enhance/codegen/ApiBootMybatisEnhanceCodegen.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
import org.minbox.framework.api.boot.maven.plugin.mybatis.enhance.codegen.tools.CamelTools;
4444
import org.minbox.framework.api.boot.maven.plugin.mybatis.enhance.codegen.writer.JavaClassWriter;
4545
import org.minbox.framework.ssh.agent.AgentConnection;
46-
import org.minbox.framework.ssh.agent.DefaultAgentConnection;
46+
import org.minbox.framework.ssh.agent.AgentSupport;
47+
import org.minbox.framework.ssh.agent.apache.ApacheMinaSshdAgentConnection;
48+
import org.minbox.framework.ssh.agent.config.AgentConfig;
4749
import org.springframework.util.ObjectUtils;
4850
import org.springframework.util.StringUtils;
4951

@@ -171,6 +173,11 @@ public class ApiBootMybatisEnhanceCodegen extends AbstractMojo {
171173
*/
172174
@Parameter
173175
private boolean enableSshProxy = false;
176+
/**
177+
* ssh代理连接方式,默认为Apache Mina
178+
*/
179+
@Parameter
180+
private AgentSupport sshProxySupport = AgentSupport.mina;
174181
/**
175182
* Ssh Proxy代理参数设置
176183
*/
@@ -211,7 +218,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
211218
getLog().info("The entity class corresponding to the " + tableNames.size() + " tables will be generated,and the table name list: " +
212219
JSON.toJSONString(tableNames));
213220
}
214-
tableNames.stream().forEach(tableName -> {
221+
tableNames.forEach(tableName -> {
215222
LocalDateTime startGetInfoTime = LocalDateTime.now();
216223
// get table
217224
Table table = dataBase.getTable(tableName);
@@ -297,7 +304,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
297304
private AgentConnection startingSshProxy(SshProxySetting setting) {
298305
AgentConnection connection = null;
299306
try {
300-
connection = new DefaultAgentConnection(setting);
307+
this.sshProxySupport = this.sshProxySupport == null ? AgentSupport.mina : this.sshProxySupport;
308+
connection = (AgentConnection) Class.forName(this.sshProxySupport.getClassName()).getDeclaredConstructor(AgentConfig.class).newInstance(setting);
301309
connection.connect();
302310
} catch (Exception e) {
303311
getLog().error("SSH Connection:" + setting.getServerIp() + ":" + setting.getForwardTargetPort() + ",try agent failure.", e);

Diff for: api-boot-project/api-boot-starters/api-boot-starter-ssh-agent/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<dependency>
3535
<groupId>org.minbox.framework</groupId>
3636
<artifactId>ssh-agent</artifactId>
37+
<version>${ssh-agent.version}</version>
3738
</dependency>
3839
</dependencies>
3940
</project>

0 commit comments

Comments
 (0)