我设置了一个示例项目,以了解当从父项目位置运行<?php
namespace App\Support;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection as BaseCollection;
class Collection extends BaseCollection
{
public function paginate($perPage, $total = null, $page = null, $pageName = 'page')
{
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
return new LengthAwarePaginator(
$this->forPage($page, $perPage),
$total ?: $this->count(),
$perPage,
$page,
[
'path' => LengthAwarePaginator::resolveCurrentPath(),
'pageName' => $pageName,
]
);
}
}
时,maven中的clean插件如何清理子项目。我以某种方式看到maven删除了父项目的目标,而不是子项目的目标。这使我感到困惑。
这是我的项目结构:
现在项目中的Java代码很少-只是一个hello world项目。我将只显示POM文件。
父项目的POM:
mvn clean:clean
子项目的POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.practice</groupId>
<artifactId>learning-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
我只关注清洁插件,而不关注其他任何东西。 因此,POM最小。我的问题是子pom无法清除目标文件夹是怎么回事?
我也在子项目的有效pom中显示<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.practice</groupId>
<artifactId>learning-maven</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>child-module1</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
标签:
<build>
答案 0 :(得分:2)
您必须在父POM中指定子模块,即:
<modules>
<module>../child-module1</module>
</modules>
答案 1 :(得分:1)
正如Arnaud所说,您需要在pom父级中添加子模块。您不需要路径,只需要artifactId
<modules>
<module>child-module1</module>
</modules>