Skip to content

XhinLiang/arthas-mvel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,319 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arthas-MVEL

JavaCI release license

Arthas-MVEL is a fork of Alibaba Arthas that adds an mvel command — evaluate arbitrary MVEL expressions against a running JVM, with bean lookup helpers, so you can read/poke application state and call methods on live objects from the Arthas console.

Everything else is stock Arthas. For general Arthas usage (watch, trace, jad, tt, profiler, …) see the official Arthas documentation. This README only covers what the fork adds.

Looking for how this fork is structured and kept in sync with upstream? See FORK.md.

What the fork adds

mvel command Evaluate an MVEL expression in the target JVM: mvel 'com.example.FooService.getInstance().reload()'.
mvel-as-default At the Arthas prompt, any line that isn't a known command is evaluated as MVEL — so you can just type com.example.Config.getInstance().getValue() directly.
Bean helpers If you define getBeanByName / getBeanByClass / getClassByName (e.g. via a Spring BeanFactory), the command resolves bare bean names automatically.

The command is packaged as a standard Arthas external command (arthas-mvel-command), loaded via the CommandResolver SPI — it does not patch arthas-core.

Quick start

Option A — single self-contained jar (Recommended)

Download just arthas-mvel.jar from the latest release and run it — no unzip, no extra files, works offline:

java -jar arthas-mvel.jar <pid>

On first run it extracts the bundled Arthas (including the mvel command) to ~/.arthas-mvel/<version>/ and attaches; subsequent runs reuse it. This is the whole distribution packaged into one file.

Option B — the full distribution

Download arthas-bin.zip from the latest release, unzip, and attach to your Java process:

unzip arthas-bin.zip -d arthas-mvel && cd arthas-mvel
./as.sh <pid>      # Linux / macOS   (as.bat on Windows)

The mvel command is bundled in the distribution's commands/ directory and loads automatically.

Option C — add mvel to an existing Arthas install

Grab arthas-mvel-command.jar from the latest release and either drop it into your Arthas home commands/ directory, or point Arthas at it on startup:

./as.sh --command-locations /path/to/arthas-mvel-command.jar <pid>

Using the mvel command

# evaluate an expression
[arthas@1234]$ mvel '1 + 1'
2

# call a static method / read a static field
[arthas@1234]$ mvel 'com.example.Singleton.getInstance().getName()'

# pick the classloader by hash (see `sc -d <class>` / `classloader`)
[arthas@1234]$ mvel -c 1be6f5c3 'com.example.Foo.staticField'

# expand the result object to N levels (default 3)
[arthas@1234]$ mvel -x 5 'com.example.Foo.getInstance()'

# mvel-as-default: no command prefix needed
[arthas@1234]$ com.example.Config.getInstance().getValue()

Options: -c, --classLoader <hash> (target classloader, default = system), -x, --expand <level> (object expand depth, default 3).

Build

Requires JDK 8+ (JAVA_HOME must be set — the native arthas-vmtool module needs jni.h).

./mvnw -V -ntp clean install -P full

The build produces packaging/target/arthas-bin.zip (full distribution), arthas-mvel-launcher/target/arthas-mvel.jar (the single self-contained launcher), and arthas-mvel-command/target/arthas-mvel-command-shade.jar (the standalone command jar). See FORK.md for build/test notes (e.g. the MCP integration tests need a local telnet).

Relationship to upstream & credits

This is a fork of alibaba/arthas (currently based on 4.2.2). All of Arthas's diagnostics, the website, docs, and the bulk of the code are the work of the Arthas authors and contributors at Alibaba — please star and support the upstream project. This fork only adds the MVEL command described above and tracks upstream periodically.

Licensed under the Apache License 2.0, same as upstream.

About

A fork of arthas which use MVEL as the first class command parser.

Resources

License

Contributing

Stars

39 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Java 81.2%
  • JavaScript 7.0%
  • Vue 5.2%
  • TypeScript 3.3%
  • HTML 0.9%
  • Shell 0.8%
  • Other 1.6%