blob: 38ae94f2a993afe7877617412d06b7c8c600f14e [file] [log] [blame] [view]
Nicholas Smith646793d2015-01-20 14:53:07 +00001## Java Parser and Abstract Syntax Tree
matozoid2cab70d2013-09-16 13:31:33 +02002
Danny van Bruggen3ad07502017-03-23 15:24:33 +01003This package contains a Java 1.0 - Java 9 Parser with AST generation and visitor support.
Nicholas Smithcd1296d2015-01-20 14:22:40 +00004
Danny van Bruggen5e6d7292017-07-16 22:19:10 +02005Our main site is at [JavaParser.org](http://javaparser.org)
matozoid2d4deca2011-10-30 14:35:59 +01006
Nicholas Smithd7c51132015-09-02 13:14:42 +01007[![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)
Nicholas Smith2b77f432015-02-23 11:01:28 +00008[![Build Status](https://travis-ci.org/javaparser/javaparser.svg?branch=master)](https://travis-ci.org/javaparser/javaparser)
Nicholas Smithcc80fc12015-08-17 15:15:26 +01009[![Coverage Status](https://coveralls.io/repos/javaparser/javaparser/badge.svg?branch=master&service=github)](https://coveralls.io/github/javaparser/javaparser?branch=master)
Nicholas Smithd6a80982015-08-17 15:25:32 +010010[![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)
Nicholas Smithcc80fc12015-08-17 15:15:26 +010011
Nicholas Smithcd1296d2015-01-20 14:22:40 +000012## Dependency Management
13
matozoid3c137e92016-04-06 19:37:37 +020014The project binaries are available in Maven Central. Just add the following to your maven configuration or tailor to your own dependency management system.
Federico Tomassetticf8d7b12014-07-30 19:00:26 +010015
Danny van Bruggen0962cf82017-08-27 20:20:12 +020016[Please refer to the Migration Guide when upgrading from 2.5.1 to 3.0.0+](https://github.com/javaparser/javaparser/wiki/Migration-Guide)
Parth Mehrotra112f4592017-07-10 13:47:53 -040017
18For Maven:
19
Danny van Bruggen11887502016-12-05 19:27:34 +010020```xml
21<dependency>
22 <groupId>com.github.javaparser</groupId>
23 <artifactId>javaparser-core</artifactId>
Danny van Bruggen0962cf82017-08-27 20:20:12 +020024 <version>3.3.3</version>
Danny van Bruggen3588d262017-02-19 23:00:47 +010025</dependency>
26```
27
Parth Mehrotra112f4592017-07-10 13:47:53 -040028For Gradle:
29
30```
Danny van Bruggen0962cf82017-08-27 20:20:12 +020031compile 'com.github.javaparser:javaparser-core:3.3.3'
Parth Mehrotra112f4592017-07-10 13:47:53 -040032```
33
Nicholas Smithcd1296d2015-01-20 14:22:40 +000034## How To Compile Sources
Nicholas Smith15a23ae2015-01-14 10:27:51 +000035
Danny van Bruggend67b5062017-04-16 15:07:23 +020036If you checked out the project from GitHub you can build the project with maven using:
Federico Tomassetticf8d7b12014-07-30 19:00:26 +010037
Federico Tomassetti2051f042014-07-30 19:01:19 +010038```
Federico Tomassetticf8d7b12014-07-30 19:00:26 +010039mvn clean install
Federico Tomassetti2051f042014-07-30 19:01:19 +010040```
Federico Tomassetticf8d7b12014-07-30 19:00:26 +010041
Danny van Bruggen11887502016-12-05 19:27:34 +010042If you checkout the sources and want to view the project in an IDE, it is best to first generate some of the source files; otherwise you will get many compilation complaints in the IDE. (mvn clean install already does this for you.)
Nicholas Smithcd1296d2015-01-20 14:22:40 +000043
44```
45mvn javacc:javacc
46```
47
Danny van Bruggen45f83182017-07-10 20:15:11 +020048If you modify the code of the AST nodes, specifically if you add or remove fields or node classes,
Danny van Bruggen969b7f62017-07-10 21:03:41 +020049the code generators will update a lot of code for you.
Danny van Bruggen45f83182017-07-10 20:15:11 +020050The `run_metamodel_generator.sh` script will rebuild the metamodel,
51which is used by the code generators which are run by `run_core_generators.sh`
52Make sure that `javaparser-core` at least compiles before you run these.
53
Nicholas Smithcd1296d2015-01-20 14:22:40 +000054## Manual
55
56Examples of how to use the library can be found on the [Manual](https://github.com/javaparser/javaparser/wiki/Manual) page of the wiki
57
Nicholas Smith26c753d2015-01-14 10:02:55 +000058## Troubleshooting
59
Danny van Bruggen11887502016-12-05 19:27:34 +010060First try the [wiki](https://github.com/javaparser/javaparser/wiki).
Nicholas Smith26c753d2015-01-14 10:02:55 +000061
Danny van Bruggen11887502016-12-05 19:27:34 +010062Didn't find an answer? Try [searching for existing issues](https://github.com/javaparser/javaparser/issues?utf8=%E2%9C%93&q=is%3Aissue%20)
63
64Still nothing? [Open an issue](https://github.com/javaparser/javaparser/issues/new) or [come chat on Gitter](https://gitter.im/javaparser/javaparser)
Federico Tomassetticf8d7b12014-07-30 19:00:26 +010065
66## Javadoc
67
Nicholas Smithc86a9ff2015-08-12 13:20:26 +010068The libraries javadoc can be found [here](http://www.javadoc.io/doc/com.github.javaparser/javaparser-core/)
Federico Tomassetticf8d7b12014-07-30 19:00:26 +010069
Didier Villevaloisd5e88432015-03-16 14:23:45 +010070## License
Nicholas Smith26c753d2015-01-14 10:02:55 +000071
Federico Tomassetti2c7ba122015-08-12 08:06:33 +020072JavaParser 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.
Federico Tomassettiee6a48a2015-07-25 14:42:17 +020073
74For details about the LGPL License please refer to [LICENSE.LGPL](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.LGPL).
75
76For details about the Apache License please refer to [LICENSE.APACHE](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.APACHE).