Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(java): expose readonly maven packaging dist dir #2624

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/api/API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions src/java/maven-packaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export interface MavenPackagingOptions {
* Configures a maven project to produce a .jar archive with sources and javadocs.
*/
export class MavenPackaging extends Component {
/**
* The directory containing the package output, relative to the project outdir
*/
public readonly distdir: string;

constructor(project: Project, pom: Pom, options: MavenPackagingOptions = {}) {
super(project);

Expand Down Expand Up @@ -78,16 +83,16 @@ export class MavenPackaging extends Component {
MAVEN_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1",
};

const distdir = options.distdir ?? "dist/java";
this.distdir = options.distdir ?? "dist/java";

for (const [k, v] of Object.entries(env)) {
this.project.packageTask.env(k, v);
}
this.project.packageTask.exec(`mkdir -p ${distdir}`);
this.project.packageTask.exec(`mkdir -p ${this.distdir}`);
this.project.packageTask.exec(
`mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/${distdir}`
`mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/${this.distdir}`
);

project.gitignore.exclude(distdir);
project.gitignore.exclude(this.distdir);
}
}