Skip to content

Commit

Permalink
update build.gradle and gradle.properties for publish to maven reposi…
Browse files Browse the repository at this point in the history
…tory (#330)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository
  • Loading branch information
xwm1992 authored May 7, 2021
1 parent 3cd6e2a commit de778dc
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 330 deletions.
130 changes: 65 additions & 65 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ allprojects {
apply plugin: "java-library"
apply plugin: 'signing'

if (project.findProperty("jdk") == "1.7") {
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = version + "-jdk7"
} else {
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = version + "-jdk8"
}

// print(project)
// if (project.findProperty("jdk") == "1.7") {
// sourceCompatibility = 1.7
// targetCompatibility = 1.7
// version = version + "-jdk7"
// } else {
// sourceCompatibility = 1.8
// targetCompatibility = 1.8
// version = version + "-jdk8"
// }
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
Expand Down Expand Up @@ -382,12 +382,6 @@ subprojects {
}
}

signing {
sign packageJavadoc, packageSources, jar
}



repositories {
maven { url "https://maven.aliyun.com/repository/public" }
mavenCentral()
Expand All @@ -400,56 +394,62 @@ subprojects {
resolutionStrategy.cacheDynamicVersionsFor 0, TimeUnit.SECONDS
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact packageSources
artifact packageJavadoc
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'EventMesh'
description = 'Apache EventMesh'
url = 'https://github.com/apache/incubator-eventmesh'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'Apache EventMesh(incubating)'
name = 'Apache EventMesh(incubating) of ASF'
url = 'https://eventmesh.apache.org/'
}
}
scm {
connection = 'scm:git:git@github.com:apache/incubator-eventmesh.git'
developerConnection = 'scm:git:git@github.com:apache/incubator-eventmesh.git'
url = 'https://github.com/apache/incubator-eventmesh'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://repository.apache.org/content/repositories/releases/'
def snapshotsRepoUrl = 'https://repository.apache.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username apacheUserName
password apachePassWord
}

// uploadArchives {
// repositories {
// mavenDeployer {
// beforeDeployment {
// MavenDeployment deployment -> signing.signPom(deployment)
// }
// // 指定上传的路径
// def releaseRepo = 'https://repository.apache.org/content/repositories/releases/'
// def snapshotsRepo = 'https://repository.apache.org/content/repositories/snapshots/'
// repository(url: releaseRepo) {
// authentication(userName: apacheUserName, password: apachePassWord)
// }
//
// snapshotRepository(url: snapshotsRepo) {
// authentication(userName: apacheUserName, password: apachePassWord)
// }
//
//
// pom.project {
// name 'Apache EventMesh'
// packaging 'jar'
// // optionally artifactId can be defined here
// description 'Apache EventMesh'
// url 'https://github.com/apache/incubator-eventmesh'
//
// scm {
// connection 'scm:git:git@github.com:apache/incubator-eventmesh.git'
// developerConnection 'scm:git:git@github.com:apache/incubator-eventmesh.git'
// url 'https://github.com/apache/incubator-eventmesh'
// }
//
// licenses {
// license {
// name 'The Apache License, Version 2.0'
// url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
// }
// }
//
// developers {
// developer {
// id 'Apache EventMesh(incubating)'
// name 'Apache EventMesh(incubating) of ASF'
// url 'https://eventmesh.apache.org/'
// }
// }
// }
// }
// }
// }
}
}
}

signing {
sign publishing.publications.mavenJava
}

}

2 changes: 1 addition & 1 deletion eventmesh-connector-rocketmq/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

group=org.apache.eventmesh
version=1.2.0
version=1.2.0-SNAPSHOT
rocketmq_version=4.7.1
mavenUserName=
mavenPassword=
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

public abstract class AbrstractHTTPServer extends AbstractRemotingServer {

public Logger logger = LoggerFactory.getLogger(this.getClass());
public Logger httpServerLogger = LoggerFactory.getLogger(this.getClass());

public Logger httpLogger = LoggerFactory.getLogger("http");

Expand Down Expand Up @@ -158,15 +158,15 @@ public void start() throws Exception {
.channel(NioServerSocketChannel.class)
.childHandler(new HttpsServerInitializer(SSLContextFactory.getSslContext())).childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE);
try {
logger.info("HTTPServer[port={}] started......", this.port);
httpServerLogger.info("HTTPServer[port={}] started......", this.port);
ChannelFuture future = b.bind(this.port).sync();
future.channel().closeFuture().sync();
} catch (Exception e) {
logger.error("HTTPServer start Err!", e);
httpServerLogger.error("HTTPServer start Err!", e);
try {
shutdown();
} catch (Exception e1) {
logger.error("HTTPServer shutdown Err!", e);
httpServerLogger.error("HTTPServer shutdown Err!", e);
}
return;
}
Expand Down Expand Up @@ -290,7 +290,7 @@ protected void channelRead0(ChannelHandlerContext ctx, HttpRequest httpRequest)
AsyncContext<HttpCommand> asyncContext = new AsyncContext<HttpCommand>(requestCommand, responseCommand, asyncContextCompleteHandler);
processEventMeshRequest(ctx, asyncContext);
} catch (Exception ex) {
logger.error("AbrstractHTTPServer.HTTPHandler.channelRead0 err", ex);
httpServerLogger.error("AbrstractHTTPServer.HTTPHandler.channelRead0 err", ex);
} finally {
try {
decoder.destroy();
Expand Down Expand Up @@ -330,7 +330,7 @@ public void processEventMeshRequest(final ChannelHandlerContext ctx,

sendResponse(ctx, asyncContext.getResponse().httpResponse());
} catch (Exception e) {
logger.error("process error", e);
httpServerLogger.error("process error", e);
}
});
} catch (RejectedExecutionException re) {
Expand Down Expand Up @@ -376,7 +376,7 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {
final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
int c = connections.incrementAndGet();
if (c > 20000) {
logger.warn("client|http|channelActive|remoteAddress={}|msg={}", remoteAddress, "too many client(20000) connect " +
httpServerLogger.warn("client|http|channelActive|remoteAddress={}|msg={}", remoteAddress, "too many client(20000) connect " +
"this eventMesh server");
ctx.close();
return;
Expand All @@ -399,7 +399,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
IdleStateEvent event = (IdleStateEvent) evt;
if (event.state().equals(IdleState.ALL_IDLE)) {
final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
logger.info("client|http|userEventTriggered|remoteAddress={}|msg={}", remoteAddress, evt.getClass()
httpServerLogger.info("client|http|userEventTriggered|remoteAddress={}|msg={}", remoteAddress, evt.getClass()
.getName());
ctx.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,37 +239,4 @@ public void onResponse(HttpCommand httpCommand) {
public boolean rejectRequest() {
return false;
}

/**
* notify ConsumerManager 组级别
*/
private void notifyConsumerManager(String consumerGroup, ConsumerGroupConf latestConsumerGroupConfig,
ConcurrentHashMap<String, ConsumerGroupConf> localConsumerGroupMapping) throws Exception {
ConsumerGroupManager cgm = eventMeshHTTPServer.getConsumerManager().getConsumer(consumerGroup);
if (cgm == null) {
ConsumerGroupStateEvent notification = new ConsumerGroupStateEvent();
notification.action = ConsumerGroupStateEvent.ConsumerGroupStateAction.NEW;
notification.consumerGroup = consumerGroup;
notification.consumerGroupConfig = latestConsumerGroupConfig;
eventMeshHTTPServer.getEventBus().post(notification);
return;
}

if (!latestConsumerGroupConfig.equals(cgm.getConsumerGroupConfig())) {
ConsumerGroupStateEvent notification = new ConsumerGroupStateEvent();
notification.action = ConsumerGroupStateEvent.ConsumerGroupStateAction.CHANGE;
notification.consumerGroup = consumerGroup;
notification.consumerGroupConfig = latestConsumerGroupConfig;
eventMeshHTTPServer.getEventBus().post(notification);
return;
}

if (latestConsumerGroupConfig == null) {
ConsumerGroupStateEvent notification = new ConsumerGroupStateEvent();
notification.action = ConsumerGroupStateEvent.ConsumerGroupStateAction.DELETE;
notification.consumerGroup = consumerGroup;
eventMeshHTTPServer.getEventBus().post(notification);
}
return;
}
}
Loading

0 comments on commit de778dc

Please sign in to comment.