Skip to content

conch-stack/conch-sa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conch-SA

Serviceability Agent

DOC:

TODO use shell to 编译

v9 IDEA 编译+运行

前提:将项目配置(Project Structure -> Project)

  • SDK 配置成 JDK 11
  • Language level 配置成 11

编译(方式一)

Windows and Linux File | Settings | Build, Execution, Deployment | Compiler | Java Compiler MacOS IntelliJ IDEA | Settings | Build, Execution, Deployment | Compiler | Java Compiler 在Override compiler parameters per-module下的 conch-sa-core-v9 后面配置:

--add-modules jdk.hotspot.agent --add-exports jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.classfile=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED

编译(方式二:推荐)

在conch-sa/conch-sa-core-v9/pom.xml的 maven-compiler-plugin插件添加配置:

<configuration>

    ... other config
    
    <compilerArgs>
        <arg>--add-modules</arg>
        <arg>jdk.hotspot.agent</arg>
        <arg>--add-exports</arg>
        <arg>jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED</arg>
        <arg>--add-exports</arg>
        <arg>jdk.hotspot.agent/sun.jvm.hotspot.classfile=ALL-UNNAMED</arg>
        <arg>--add-exports</arg>
        <arg>jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED</arg>
        <arg>--add-exports</arg>
        <arg>jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED</arg>
        <arg>--add-exports</arg>
        <arg>jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED</arg>
    </compilerArgs>
</configuration>

运行

Run/Debug Configurations 添加 Add VM options 并配置

--add-modules jdk.hotspot.agent --add-exports jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.classfile=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED --add-exports jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED

v8 IDEA 编译+运行

前提:将项目配置(Project Structure -> Project)

  • SDK 配置成 JDK 8
  • Language level 配置成 8

编译

在conch-sa/conch-sa-core-v8/pom.xml的 maven-compiler-plugin插件添加配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven.compiler.plugin}</version>
    <configuration>
        <encoding>${project.encoding}</encoding>
        <source>${java.version}</source>
        <target>${java.version}</target>
            <compilerArguments>
                <!-- 要添加编译 类路径 bootclasspath: 指定sa-jdi.jar -->
                <bootclasspath>
                    ${java.home}/../lib/sa-jdi.jar${path.separator}${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar${path.separator}${java.home}/../lib/tools.jar
                </bootclasspath>
            </compilerArguments>
    </configuration>
</plugin>

运行

Project Structure -> SDKs 对应的1.8的SDK里面新增依赖,如下图: image-1

Releases

No releases published

Packages

No packages published