Skip to content

Commit

Permalink
1. 优化pom文件结构
Browse files Browse the repository at this point in the history
2. 优化部分不正确的注视代码
3. 优化package脚本逻辑,更严谨
  • Loading branch information
dukun committed Nov 15, 2017
1 parent 4d2daa0 commit 0db9382
Show file tree
Hide file tree
Showing 38 changed files with 119 additions and 330 deletions.
20 changes: 9 additions & 11 deletions bin/sandbox-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,22 @@ mkdir -p ${SANDBOX_TARGET_DIR}/provider


# copy jar to TARGET_DIR
cp ../sandbox-core/target/sandbox-core-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/lib/sandbox-core.jar
cp ../sandbox-agent/target/sandbox-agent-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/lib/sandbox-agent.jar
cp ../sandbox-spy/target/sandbox-spy-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/lib/sandbox-spy.jar
cp sandbox-logback.xml ${SANDBOX_TARGET_DIR}/cfg/sandbox-logback.xml
cp sandbox.properties ${SANDBOX_TARGET_DIR}/cfg/sandbox.properties
cp sandbox.sh ${SANDBOX_TARGET_DIR}/bin/sandbox.sh
cp install-local.sh ${SANDBOX_TARGET_DIR}/install-local.sh
cp ../sandbox-core/target/sandbox-core-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/lib/sandbox-core.jar \
&& cp ../sandbox-agent/target/sandbox-agent-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/lib/sandbox-agent.jar \
&& cp ../sandbox-spy/target/sandbox-spy-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/lib/sandbox-spy.jar \
&& cp sandbox-logback.xml ${SANDBOX_TARGET_DIR}/cfg/sandbox-logback.xml \
&& cp sandbox.properties ${SANDBOX_TARGET_DIR}/cfg/sandbox.properties \
&& cp sandbox.sh ${SANDBOX_TARGET_DIR}/bin/sandbox.sh \
&& cp install-local.sh ${SANDBOX_TARGET_DIR}/install-local.sh
echo "${SANDBOX_VERSION}" > ${SANDBOX_TARGET_DIR}/cfg/version

# for test
## cp ../sandbox-debug-module/target/sandbox-debug-module-*-jar-with-dependencies.jar\
## ${SANDBOX_TARGET_DIR}/module/sandbox-debug-module.jar

# for mgr
cp ../sandbox-mgr-module/target/sandbox-mgr-module-*-jar-with-dependencies.jar\
${SANDBOX_TARGET_DIR}/module/sandbox-mgr-module.jar
cp ../sandbox-mgr-provider/target/sandbox-mgr-provider-*-jar-with-dependencies.jar\
${SANDBOX_TARGET_DIR}/provider/sandbox-mgr-provider.jar
cp ../sandbox-mgr-module/target/sandbox-mgr-module-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/module/sandbox-mgr-module.jar \
&& cp ../sandbox-mgr-provider/target/sandbox-mgr-provider-*-jar-with-dependencies.jar ${SANDBOX_TARGET_DIR}/provider/sandbox-mgr-provider.jar

# make it execute able
chmod +x ${SANDBOX_TARGET_DIR}/*.sh
Expand Down
50 changes: 34 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- 这个如果开源之后,不再需要
<parent>
<groupId>com.taobao</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
</parent>
-->

<groupId>com.alibaba.jvm.sandbox</groupId>
<artifactId>sandbox</artifactId>
<version>1.0.0-SNAPSHOT</version>
Expand All @@ -37,6 +29,31 @@
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -174,17 +191,18 @@
<module>sandbox-mgr-provider</module>
</modules>

<!--

<!-- 这里是为了发布到MAVEN中央仓库所做的配置 -->
<distributionManagement>
<repository>
<id>alibaba-releases</id>
<url>http://mvnrepo.alibaba-inc.com/mvn/releases</url>
</repository>
<snapshotRepository>
<id>alibaba-snapshots</id>
<url>http://mvnrepo.alibaba-inc.com/mvn/snapshots</url>
<id>luanjia-ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>luanjia-ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
-->


</project>
19 changes: 3 additions & 16 deletions sandbox-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,11 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>sandbox-agent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>sandbox-agent</name>
<name>sandbox-agent ${project.version}</name>

<build>
<finalName>sandbox-agent</finalName>
<finalName>sandbox-agent-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -52,7 +41,5 @@
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
51 changes: 3 additions & 48 deletions sandbox-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,8 @@
</parent>
<artifactId>sandbox-api</artifactId>
<version>${sandbox.api.version}</version>
<name>sandbox-api</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<!-- 过期的配置
<configuration>
<aggregate>true</aggregate>
</configuration>
-->
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<name>sandbox-api ${sandbox.api.version}</name>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
Expand All @@ -66,7 +23,5 @@
<artifactId>sandbox-common-api</artifactId>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
49 changes: 1 addition & 48 deletions sandbox-common-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,5 @@
</parent>
<artifactId>sandbox-common-api</artifactId>
<version>${sandbox.common.api.version}</version>
<name>sandbox-common-api</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<!-- 过期的配置
<configuration>
<aggregate>true</aggregate>
</configuration>
-->
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<name>sandbox-common-api ${sandbox.common.api.version}</name>
</project>
17 changes: 2 additions & 15 deletions sandbox-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,11 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>sandbox-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>sandbox-core</name>
<name>sandbox-core ${project.version}</name>

<build>
<finalName>sandbox-core-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -134,7 +124,4 @@
<artifactId>ant</artifactId>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private boolean isLaunchByAttachMode() {
}

/**
* 获取沙箱的启动模式<br/>
* 获取沙箱的启动模式
* 默认按照ATTACH模式启动
*
* @return 沙箱的启动模式
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Routing(final ClassLoader classLoader, final String... regexExpressArray)
}

/**
* 当前参与匹配的Java类名是否命中路由匹配规则 <br/>
* 当前参与匹配的Java类名是否命中路由匹配规则
* 命中匹配规则的类加载,将会从此ClassLoader中完成对应的加载行为
*
* @param javaClassName 参与匹配的Java类名
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public interface Enhancer {

/**
* 转换为增强后的字节码数组<br/>
* 转换为增强后的字节码数组
*
* @param loader 目标类加载器
* @param srcByteCodeArray 源字节码数组
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.alibaba.jvm.sandbox.core.enhance;

/**
* 未捕获异常<br/>
* 未捕获异常
* 用来封装不希望抛出的异常
* Created by luanjia@taobao.com on 16/5/21.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.lang.annotation.*;

/**
* 中断式事件处理器<br/>
* 中断式事件处理器
* 当事件处理器处理事件抛出异常时,将会中断原有方法调用
* Created by luanjia@taobao.com on 16/7/26.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.alibaba.jvm.sandbox.core.enhance.weaver;

/**
* 代码锁<br/>
* 代码锁
* 什么叫代码锁?代码锁的出现是由于在字节码中,我们无法用简单的if语句来判定这段代码是生成的还是原有的。
* 这会导致一些监控逻辑的混乱,比如trace命令如果不使用代码锁保护,将能看到Greys所植入的代码并进行跟踪
* Created by oldmanpushcart@gmail.com on 15/5/28.
*/
public interface CodeLock {

/**
* 根据字节码流锁或解锁代码<br/>
* 根据字节码流锁或解锁代码
* 通过对字节码流的判断,决定当前代码是锁定和解锁
*
* @param opcode 字节码
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.objectweb.asm.commons.AdviceAdapter;

/**
* ASM代码锁<br/>
* ASM代码锁
* Created by oldmanpushcart@gmail.com on 15/5/28.
*/
public class AsmCodeLock implements CodeLock, Opcodes {
Expand Down Expand Up @@ -71,7 +71,7 @@ public void code(int code) {
}

/*
* 重置索引<br/>
* 重置索引
* 一般在代码序列判断失败时,则会对索引进行重置,冲头开始匹配特征序列
*/
private void reset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static com.alibaba.jvm.sandbox.core.util.SandboxReflectUtils.unCaughtGetClassDeclaredJavaMethod;

/**
* 常用的ASM method 集合<br/>
* 常用的ASM method 集合
* 省得我到处声明
* Created by luanjia@taobao.com on 16/5/21.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.com.alibaba.jvm.sandbox.spy.Spy;

/**
* 常用的ASM type集合<br/>
* 常用的ASM type集合
* 省得我到处声明
* Created by luanjia@taobao.com on 16/5/21.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void processControl() {
}

/**
* 加载ClassLoader<br/>
* 加载ClassLoader
* 这里分开静态方法中ClassLoader的获取以及普通方法中ClassLoader的获取
* 主要是性能上的考虑
*/
Expand Down
Loading

0 comments on commit 0db9382

Please sign in to comment.