[MPMD-407] Upgrade to Doxia 2.0.0 GA Stack · apache/maven-pmd-plugin@e99d2e4 (original) (raw)

`@@ -37,8 +37,6 @@

`

37

37

``

38

38

`import net.sourceforge.pmd.PMDVersion;

`

39

39

`import org.apache.maven.execution.MavenSession;

`

40

``

`-

import org.apache.maven.model.ReportPlugin;

`

41

``

`-

import org.apache.maven.model.Reporting;

`

42

40

`import org.apache.maven.plugin.MojoExecution;

`

43

41

`import org.apache.maven.plugins.annotations.Component;

`

44

42

`import org.apache.maven.plugins.annotations.Parameter;

`

`@@ -48,7 +46,6 @@

`

48

46

`import org.apache.maven.toolchain.Toolchain;

`

49

47

`import org.apache.maven.toolchain.ToolchainManager;

`

50

48

`import org.codehaus.plexus.util.FileUtils;

`

51

``

`-

import org.codehaus.plexus.util.PathTool;

`

52

49

`import org.codehaus.plexus.util.StringUtils;

`

53

50

``

54

51

`/**

`

`@@ -283,45 +280,6 @@ protected MojoExecution getMojoExecution() {

`

283

280

`return mojoExecution;

`

284

281

` }

`

285

282

``

286

``

`-

protected String constructXrefLocation(boolean test) {

`

287

``

`-

String location = null;

`

288

``

`-

if (linkXRef) {

`

289

``

`-

File xrefLocation = getXrefLocation(test);

`

290

``

-

291

``

`-

String relativePath = PathTool.getRelativePath(

`

292

``

`-

getReportOutputDirectory().getAbsolutePath(), xrefLocation.getAbsolutePath());

`

293

``

`-

if (relativePath == null || relativePath.isEmpty()) {

`

294

``

`-

relativePath = ".";

`

295

``

`-

}

`

296

``

`-

relativePath = relativePath + "/" + xrefLocation.getName();

`

297

``

`-

if (xrefLocation.exists()) {

`

298

``

`-

// XRef was already generated by manual execution of a lifecycle binding

`

299

``

`-

location = relativePath;

`

300

``

`-

} else {

`

301

``

`-

// Not yet generated - check if the report is on its way

`

302

``

`-

Reporting reporting = project.getModel().getReporting();

`

303

``

`-

List reportPlugins =

`

304

``

`-

reporting != null ? reporting.getPlugins() : Collections.emptyList();

`

305

``

`-

for (ReportPlugin plugin : reportPlugins) {

`

306

``

`-

String artifactId = plugin.getArtifactId();

`

307

``

`-

if ("maven-jxr-plugin".equals(artifactId)) {

`

308

``

`-

location = relativePath;

`

309

``

`-

}

`

310

``

`-

}

`

311

``

`-

}

`

312

``

-

313

``

`-

if (location == null) {

`

314

``

`-

getLog().warn("Unable to locate" + (test ? " Test" : "") + " Source XRef to link to - DISABLED");

`

315

``

`-

}

`

316

``

`-

}

`

317

``

`-

return location;

`

318

``

`-

}

`

319

``

-

320

``

`-

protected File getXrefLocation(boolean test) {

`

321

``

`-

File location = test ? xrefTestLocation : xrefLocation;

`

322

``

`-

return location != null ? location : new File(getReportOutputDirectory(), test ? "xref-test" : "xref");

`

323

``

`-

}

`

324

``

-

325

283

`/**

`

326

284

` * Convenience method to get the list of files where the PMD tool will be executed

`

327

285

` *

`

`@@ -355,7 +313,7 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {

`

355

313

`for (String root : compileSourceRoots) {

`

356

314

`File sroot = new File(root);

`

357

315

`if (sroot.exists()) {

`

358

``

`-

String sourceXref = constructXrefLocation(false);

`

``

316

`+

String sourceXref = linkXRef ? constructXrefLocation(xrefLocation, false) : null;

`

359

317

`directories.add(new PmdFileInfo(project, sroot, sourceXref));

`

360

318

` }

`

361

319

` }

`

`@@ -368,8 +326,8 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {

`

368

326

`for (String root : testSourceRoots) {

`

369

327

`File sroot = new File(root);

`

370

328

`if (sroot.exists()) {

`

371

``

`-

String testXref = constructXrefLocation(true);

`

372

``

`-

directories.add(new PmdFileInfo(project, sroot, testXref));

`

``

329

`+

String testSourceXref = linkXRef ? constructXrefLocation(xrefTestLocation, true) : null;

`

``

330

`+

directories.add(new PmdFileInfo(project, sroot, testSourceXref));

`

373

331

` }

`

374

332

` }

`

375

333

` }

`

`@@ -379,7 +337,7 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {

`

379

337

`for (String root : localCompileSourceRoots) {

`

380

338

`File sroot = new File(root);

`

381

339

`if (sroot.exists()) {

`

382

``

`-

String sourceXref = constructXrefLocation(false);

`

``

340

`+

String sourceXref = linkXRef ? constructXrefLocation(xrefLocation, false) : null;

`

383

341

`directories.add(new PmdFileInfo(localProject, sroot, sourceXref));

`

384

342

` }

`

385

343

` }

`

`@@ -388,8 +346,8 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {

`

388

346

`for (String root : localTestCompileSourceRoots) {

`

389

347

`File sroot = new File(root);

`

390

348

`if (sroot.exists()) {

`

391

``

`-

String testXref = constructXrefLocation(true);

`

392

``

`-

directories.add(new PmdFileInfo(localProject, sroot, testXref));

`

``

349

`+

String testSourceXref = linkXRef ? constructXrefLocation(xrefTestLocation, true) : null;

`

``

350

`+

directories.add(new PmdFileInfo(localProject, sroot, testSourceXref));

`

393

351

` }

`

394

352

` }

`

395

353

` }

`