Debian Codegraph @

doc/readme.md

raw
1
2 <!--
3 Note that edits to this readme should be done via `docs/readme.md`.
4 Modifying this file directly within the root directory risks it being overwritten.
5 -->
6
7 # JavaParser
8
9 [![Maven Central](https://img.shields.io/maven-central/v/com.github.javaparser/javaparser-core.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.javaparser%22%20AND%20a%3A%22javaparser-core%22)
10 [![Build Status](https://travis-ci.org/javaparser/javaparser.svg?branch=master)](https://travis-ci.org/javaparser/javaparser)
11 [![Coverage Status](https://codecov.io/gh/javaparser/javaparser/branch/master/graphs/badge.svg?branch=master)](https://app.codecov.io/gh/javaparser/javaparser?branch=master)
12 [![Join the chat at https://gitter.im/javaparser/javaparser](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/javaparser/javaparser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
13 [![License LGPL-3/Apache-2.0](https://img.shields.io/badge/license-LGPL--3%2FApache--2.0-blue.svg)](LICENSE)
14 [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2667378.svg)](https://doi.org/10.5281/zenodo.2667378)
15
16
17 This project contains a set of libraries implementing a Java 1.0 - Java 15 Parser with advanced analysis functionalities. This includes preview features to Java 13, with Java 14 preview features work-in-progress.
18
19 Our main site is at [JavaParser.org](http://javaparser.org)
20
21 ## Setup
22
23 The project binaries are available in Maven Central.
24
25 We strongly advise users to adopt Maven, Gradle or another build system for their projects.
26 If you are not familiar with them we suggest taking a look at the maven quickstart projects
27 ([javaparser-maven-sample](https://github.com/javaparser/javaparser-maven-sample),
28 [javasymbolsolver-maven-sample](https://github.com/javaparser/javasymbolsolver-maven-sample)).
29
30 Just add the following to your maven configuration or tailor to your own dependency management system.
31
32 [Please refer to the Migration Guide when upgrading from 2.5.1 to 3.0.0+](https://github.com/javaparser/javaparser/wiki/Migration-Guide)
33
34 **Maven**:
35
36 ```xml
37 <dependency>
38 <groupId>com.github.javaparser</groupId>
39 <artifactId>javaparser-symbol-solver-core</artifactId>
40 <version>${project.version}</version>
41 </dependency>
42 ```
43
44 **Gradle**:
45
46 ```
47 implementation 'com.github.javaparser:javaparser-symbol-solver-core:${project.version}'
48 ```
49
50 Since Version 3.5.10, the JavaParser project includes the JavaSymbolSolver.
51 While JavaParser generates an Abstract Syntax Tree, JavaSymbolSolver analyzes that AST and is able to find
52 the relation between an element and its declaration (e.g. for a variable name it could be a parameter of a method, providing information about its type, position in the AST, ect).
53
54 Using the dependency above will add both JavaParser and JavaSymbolSolver to your project. If you only need the core functionality of parsing Java source code in order to traverse and manipulate the generated AST, you can reduce your projects boilerplate by only including JavaParser to your project:
55
56 **Maven**:
57
58 ```xml
59 <dependency>
60 <groupId>com.github.javaparser</groupId>
61 <artifactId>javaparser-core</artifactId>
62 <version>${project.version}</version>
63 </dependency>
64 ```
65
66 **Gradle**:
67
68 ```
69 implementation 'com.github.javaparser:javaparser-core:${project.version}'
70 ```
71
72 Since version 3.6.17 the AST can be serialized to JSON.
73 There is a separate module for this:
74
75 **Maven**:
76
77 ```xml
78 <dependency>
79 <groupId>com.github.javaparser</groupId>
80 <artifactId>javaparser-core-serialization</artifactId>
81 <version>${project.version}</version>
82 </dependency>
83 ```
84
85 **Gradle**:
86
87 ```
88 implementation 'com.github.javaparser:javaparser-core-serialization:${project.version}'
89 ```
90
91 ## How To Compile Sources
92
93 If you checked out the project's source code from GitHub, you can build the project with maven using:
94 ```
95 mvnw clean install
96 ```
97
98 If you want to generate the packaged jar files from the source files, you run the following maven command:
99 ```
100 mvnw package
101 ```
102
103 **NOTE** the jar files for the two modules can be found in:
104 - `javaparser/javaparser-core/target/javaparser-core-\<version\>.jar`
105 - `javaparser-symbol-solver-core/target/javaparser-symbol-solver-core-\<version\>.jar`
106
107 If you checkout the sources and want to view the project in an IDE, it is best to first generate some of the source files;
108 otherwise you will get many compilation complaints in the IDE. (`mvnw clean install` already does this for you.)
109
110 ```
111 mvnw javacc:javacc
112 ```
113
114 If you modify the code of the AST nodes, specifically if you add or remove fields or node classes,
115 the code generators will update a lot of code for you.
116 The `run_metamodel_generator.sh` script will rebuild the metamodel,
117 which is used by the code generators which are run by `run_core_generators.sh`
118 Make sure that `javaparser-core` at least compiles before you run these.
119
120 **Note**: for Eclipse IDE follow the steps described in the wiki: https://github.com/javaparser/javaparser/wiki/Eclipse-Project-Setup-Guide
121
122 ## More information
123
124 #### [JavaParser.org](https://javaparser.org) is the main information site.
125
126 ## License
127
128 JavaParser is available either under the terms of the LGPL License or the Apache License. You as the user are entitled to choose the terms under which adopt JavaParser.
129
130 For details about the LGPL License please refer to [LICENSE.LGPL](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.LGPL).
131
132 For details about the Apache License please refer to [LICENSE.APACHE](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.APACHE).