当我的pom设置为打包类型"pom"时,我在运行单元测试时遇到了一些问题.起初,它说该项目不需要任何目标,因此我将maven-surefire-plugin添加到我的pom.xml中,以将测试阶段绑定到maven-surefire-plugin测试目标.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
现在,surefire插件正在执行,但它表示没有测试可以运行.如果我将包装类型更改为jar并运行mvn test,那么它会获取我的测试文件.
当我运行mvn test -X时,它会显示"testSourceDirectory = C:\ dev\dsl\src\test\java",这是正确的位置.包装类型"pom"的测试位置是否与"jar"不同?我尝试添加
<configuration>
<testSourceDirectory>src/test/java</testSourceDirectory>
</configuration>
Run Code Online (Sandbox Code Playgroud)
到surefire插件,但它根本没有帮助.
我有一个多模块项目,如下所示:
module2中的pom.xml依赖于module1.
当我运行mvn clean编译时,我收到以下错误:
反应堆中的项目包含循环参考.
这是我在module1中的依赖项:
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.48</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么它说有一个循环引用.即使我做了mvn依赖:在module1上的树,我得到以下内容:
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- com.jcraft:jsch:jar:0.1.48:compile
[INFO] \- junit:junit:jar:4.8.2:test
Run Code Online (Sandbox Code Playgroud)
在我看来,在module1中没有对module2的任何引用.那么循环引用来自何处?
编辑:以下是调试日志:
+ Error stacktraces are turned on.
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.6.0_31
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
[INFO] Scanning …Run Code Online (Sandbox Code Playgroud) 我有一个 flutter 应用程序,我想向其中添加状态导航。我希望拥有它,以便您可以查看“Foos”列表,然后选择要查看的 Foo。在 Foo 详细信息页面上,我想要有 3 个选项卡,并在这三个选项卡上有状态导航。网址看起来像这样:
我正在按照这个示例合并 go_router 的StatefulShellRoute. 该示例看起来与我想要的一模一样,除了当我使用参数化路由将其添加到我的应用程序时,我收到此错误:
The default location of a StatefulShellBranch cannot be a parameterized route
Run Code Online (Sandbox Code Playgroud)
该错误似乎意味着我无法在参数化的页面上启动有状态分支,但这就是我希望开始带有选项卡的嵌套导航的地方。有没有办法解决这个问题或有其他方法来实现这个目标?
这是我尝试设置的路由器:
final GoRouter _router = GoRouter(
navigatorKey: _rootNavigatorKey,
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return MyHomePage();
},
routes: [
GoRoute(
path: 'foo',
builder: (BuildContext context, GoRouterState state) {
return const FooListScreen();
},
routes: [
StatefulShellRoute.indexedStack(
builder: (context, state, navigationShell) {
return Scaffold(body: …Run Code Online (Sandbox Code Playgroud)