java

package
v1.8.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 16 Imported by: 0

README

Manual build process in case automatic build failure

Introduction

This guide assists you in manually building your project and preparing it for call graph analysis after an automatic build process fails. This ensures that you can still generate a call graph for your Java project despite any issues with the automatic procedures.

Manual Build Steps

Verify Java Version

Ensure you're using at least Java 11, which is required by the call graph generation process. Check your current Java version with:

java -version
Manual Build Command

In the project directory, execute the Maven build command to compile your project and generate the necessary .class files, while skipping tests to expedite the process:

mvn package -q -DskipTests -e
Copy External Dependencies

After a successful build, copy your project's external dependencies to the .debrickedTmpFolder using the following command. This prepares your project for call graph generation by ensuring all dependencies are available:

mvn -q -B dependency:copy-dependencies -DoutputDirectory=./.debrickedTmpFolder -DskipTests -e

Preparing for Call Graph Generation Without Automatic Build

If the build fails and cannot be resolved, or if you prefer to use your pre-built .class files:

  • Use the --no-build flag with the call graph generation command to bypass the build process:
debricked callgraph --no-build
  • Ensure all .class files and external dependencies are correctly placed as per the manual build steps.

Excluding Specific pom.xml Files

To exclude specific pom.xml files or any other files from the call graph generation, use the exclusion flags provided by the CLI tool. Here’s how:

Using Exclusion Flags

When running the debricked callgraph command, use the -e or --exclusions flag to specify patterns for files you wish to exclude. For example, to exclude all pom.xml files located in any directory:

debricked callgraph -e "**/pom.xml"

Adjust the pattern as necessary to target specific files or directories.

Additional Tips

  • Common Errors and Solutions: Refer to the official documentation for common errors, such as "out of memory" issues. Consider adjusting your Java VM options to allocate more memory for the process if necessary.
  • Advanced Exclusions: Utilize advanced pattern matching (e.g., {alt1,...}) to fine-tune exclusions, especially when working with multiple build configurations or problematic dependencies.

Conclusion

Following these steps should mitigate issues encountered during the automatic build process, allowing for successful manual preparation for call graph generation. For further assistance or unresolved issues, consult the existing documentation or contact support for more detailed guidance.

Documentation

Index

Constants

View Source
const Name = "java"
View Source
const StandardVersion = "11"

Variables

This section is empty.

Functions

This section is empty.

Types

type Callgraph

type Callgraph struct {
	// contains filtered or unexported fields
}

func NewCallgraph

func NewCallgraph(
	cmdFactory ICmdFactory,
	workingDirectory string,
	targetClasses []string,
	targetDir string,
	outputName string,
	filesystem ioFs.IFileSystem,
	ctx cgexec.IContext,
) Callgraph

func (*Callgraph) RunCallGraph

func (cg *Callgraph) RunCallGraph(callgraphJarPath string) error

func (*Callgraph) RunCallGraphWithSetup

func (cg *Callgraph) RunCallGraphWithSetup() error

type CmdFactory

type CmdFactory struct{}

func (CmdFactory) MakeBuildMavenCmd

func (_ CmdFactory) MakeBuildMavenCmd(workingDirectory string, ctx cgexec.IContext) (*exec.Cmd, error)

func (CmdFactory) MakeCallGraphGenerationCmd

func (_ CmdFactory) MakeCallGraphGenerationCmd(
	callgraphJarPath string,
	workingDirectory string,
	targetClasses []string,
	dependencyClasses string,
	outputName string,
	ctx cgexec.IContext,
) (*exec.Cmd, error)

func (CmdFactory) MakeMvnCopyDependenciesCmd

func (_ CmdFactory) MakeMvnCopyDependenciesCmd(
	workingDirectory string,
	targetDir string,
	ctx cgexec.IContext,
) (*exec.Cmd, error)

type ICallgraph

type ICallgraph interface {
	RunCallGraphWithSetup() error
	RunCallGraph(callgraphJarPath string) error
}

type ICmdFactory

type ICmdFactory interface {
	MakeMvnCopyDependenciesCmd(workingDirectory string, targetDir string, ctx cgexec.IContext) (*exec.Cmd, error)
	MakeCallGraphGenerationCmd(callgraphJarPath string, workingDirectory string, targetClasses []string, dependencyClasses string, outputName string, ctx cgexec.IContext) (*exec.Cmd, error)
	MakeBuildMavenCmd(workingDirectory string, ctx cgexec.IContext) (*exec.Cmd, error)
}

type Job

type Job struct {
	job.BaseJob
	// contains filtered or unexported fields
}

func NewJob

func NewJob(dir string, files []string, cmdFactory ICmdFactory, writer ioFs.IFileWriter, archive io.IArchive, config conf.IConfig, ctx cgexec.IContext, fs ioFs.IFileSystem) *Job

func (*Job) Run

func (j *Job) Run()

type Language

type Language struct {
	// contains filtered or unexported fields
}

func NewLanguage

func NewLanguage() Language

func (Language) Name

func (language Language) Name() string

func (Language) Version

func (language Language) Version() string

type Strategy

type Strategy struct {
	// contains filtered or unexported fields
}

func NewStrategy

func NewStrategy(config conf.IConfig, files []string, paths []string, exclusions []string, finder finder.IFinder, ctx cgexec.IContext) Strategy

func (Strategy) Invoke

func (s Strategy) Invoke() ([]job.IJob, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL