微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MAVEN-Azure:没有可编译的资源

如何解决MAVEN-Azure:没有可编译的资源

需要将appium测试框架与天蓝色的CI / CD管道集成的帮助。我知道我们必须为仿真器,应用程序等更新一些路径,但是从一开始,我们至少需要使代码到达该点。

我们为Android应用创建了使用Junit + Appium + Cucumber的测试框架。团队现在希望将其集成到Azure管道中。我们可以使用“ mvn test”命令在本地系统上手动运行套件。 但是,当在GIT中提取相同的配置和框架并在azure上进行构建时,测试将导致以下错误

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.xamarin.appium:run-test >---------------------
[INFO] Building run-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ run-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources,i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ run-test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ run-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources,i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ run-test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ run-test ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running Runner.TestRunner
[ERROR] Tests run: 1,Failures: 0,Errors: 1,Skipped: 0,Time elapsed: 0.281 s <<< FAILURE! - in Runner.TestRunner
[ERROR] Runner.TestRunner.initializationError  Time elapsed: 0.006 s  <<< ERROR!
java.lang.IllegalArgumentException: Not a file or directory: src/test/java/Features/AppName/testFunctionality.feature

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   TestRunner.initializationError » IllegalArgument Not a file or directory: /Vol...
[INFO] 
[ERROR] Tests run: 1,Skipped: 0
[INFO] 
[ERROR] There are test failures.

Please refer to target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump,[date]-jvmrun[N].dump and [date].dumpstream.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ run-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: target/run-test-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-failsafe-plugin:3.0.0-M4:integration-test (default) @ run-test ---
[INFO] 
[INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (default) @ run-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.000 s
[INFO] Finished at: 2020-10-19T19:14:51+02:00
[INFO] ------------------------------------------------------------------------

POM文件

<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.bechtel</groupId>
    <artifactId>bps_cucumber</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>bps_cucumber</name>
    <url>http://maven.apache.org</url>
    
    <repositories>
    <repository>
      <id>jcenter</id>
      <url>https://jcenter.bintray.com/</url>
    </repository>
</repositories>



    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>
    
    
    <build>
            

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                
            </plugin>
        </plugins>
            <defaultGoal>install</defaultGoal>
        
    </build>


    <dependencies>

        <!-- Appium -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.3.0</version>
        </dependency>
        
        <!-- Appium for appcenter -->
        <dependency>
    <groupId>com.microsoft.appcenter</groupId>
    <artifactId>appium-test-extension</artifactId>
    <version>1.5</version>
</dependency>

<dependency> 
 <groupId>net.sourceforge.tess4j</groupId> 
 <artifactId>tess4j</artifactId> 
 <version>3.2.1</version> 
</dependency>

        <!-- Selenium -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>
        
        <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>1.2.6</version>
        <scope>test</scope>
    </dependency>

        <!-- Cucumber -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.6</version>
        </dependency>
        
        <dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>1.2.6</version>
    <scope>test</scope>
</dependency>

        <!-- Junit -->
        <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>

        <!-- Base.startServer() -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.30</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.6</version>
        </dependency>

        <!-- Extent Reporting -->
        <dependency>
            <groupId>com.vimalselvam</groupId>
            <artifactId>cucumber-extentsreport</artifactId>
            <version>3.0.2</version>
        </dependency>
        <dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>3.1.2</version>
        </dependency>
    </dependencies>
    <profiles>
    <profile>
  <id>prepare-for-upload</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.10</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/upload/dependency-jars/</outputDirectory>
              <useRepositoryLayout>true</useRepositoryLayout>
              <copyPom>true</copyPom>
              <addParentPoms>true</addParentPoms>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-help-plugin</artifactId>
        <version>2.2</version>
        <executions>
          <execution>
            <id>generate-pom</id>
            <phase>package</phase>
            <goals>
              <goal>effective-pom</goal>
            </goals>
            <configuration>
              <output>${project.build.directory}/upload/pom.xml</output>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-testclasses</id>
            <phase>package</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/upload/test-classes</outputDirectory>
              <resources>
                <resource>
                  <directory>
                    ${project.build.testOutputDirectory}
                  </directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>
    </profiles>
</project>

我尝试添加以下内容来构建代码

<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>

但是在本地系统上,这会导致更新文件夹结构,并且eclipse无法识别任何蛋糕。

下面是结构:

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。