IntelliJ Idea:未检测到测试资源

时间:2020-08-26 02:03:11

标签: intellij-idea

我正在使用@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView tv_greeting = findViewById(R.id.tv_greeting); final TextView tv_start = findViewById(R.id.tv_start); tv_greeting.setVisibility(View.INVISIBLE); tv_start.setOnClickListener(view -> { printTranslationY(tv_greeting, "onclick 1"); tv_greeting.setTranslationY(1000); // setTranslationY work here printTranslationY(tv_greeting, "onclick 2"); tv_greeting.postDelayed(() -> { tv_greeting.animate() .translationYBy(-1000) .setDuration(500) .setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { printTranslationY(tv_greeting, "animate 1 before start"); tv_greeting.setTranslationY(1100); // setTranslationY not work here printTranslationY(tv_greeting, "animate 1 after start"); } @Override public void onAnimationEnd(Animator animator) { } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }) .start(); }, 1000); tv_greeting.postDelayed(() -> { tv_greeting.animate() .translationYBy(-300) .setDuration(500) .setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { printTranslationY(tv_greeting, "animate 2 start"); } @Override public void onAnimationEnd(Animator animator) { } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }) .start(); }, 3000); }); } private void printTranslationY(TextView textView, String where) { Log.d(TAG, String.format("translationY = %f %s", textView.getTranslationY(), where)); } 添加测试源和资源:

translationY = 0.000000 onclick 1
translationY = 1000.000000 onclick 2
translationY = 1000.000000 animate 1 before start
translationY = 1100.000000 animate 1 after start
translationY = 0.000000 animate 2 start

Idea未将测试资源目录build-helper-maven-plugin <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>${build-helper-maven-plugin.version}</version> <executions> <execution> <id>add-test-source</id> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>src/it/java</source> </sources> </configuration> </execution> <execution> <id>add-test-resource</id> <goals> <goal>add-test-resource</goal> </goals> <configuration> <resources> <resource> <directory>src/it/java</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> <resource> <directory>src/it/resources</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> 检测为测试资源:

enter image description here

我试图重新导入Maven项目,重新启动,使缓存无效等。

我的想法版本:

src/it/resources

谢谢!

1 个答案:

答案 0 :(得分:0)

我解决了将IDEA更新到2020版本的问题。