Xray-App / xray-maven-plugin

Xray Maven Plugin
BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link

I don't think the pom.xml snippet is correct on the readme #53

Closed terencenmnpan closed 1 year ago

terencenmnpan commented 1 year ago

snippet from readme:

      <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.7.0</version>
            <scope>test</scope>
            <configuration>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <cloud>true</cloud>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
            </configuration>
        </dependency>

I think it should be like:

<plugin>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.7.0</version>
            <configuration>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <cloud>true</cloud>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
            </configuration>
</plugin>
bitcoder commented 1 year ago

thanks @terencenmnpan , good point. I think you're right but I'm not 100% sure. Can you pls point to some documentation that clarifies that? I found this but I was unable to find something on the inclusion of plugins on the pom.xml file in that docs.. maybe I missed it.

some other refs:

terencenmnpan commented 1 year ago

maven dependency is used when we want to be able to call the library in our code through the classpath. In your case, the xray maven plugin is generally not used to be called in code, but rather used in the build lifecycle with maven to perform a task. We are using your plugin to do the task: send the cucumber report to jira.

In the first stackoverflow article you linked: "But the difference between them is, most of the work in maven is done using plugins; whereas dependency is just a Jar file which will be added to the classpath while executing the tasks."

If you put your plugin in the dependency, nothing will be done in the maven lifecycle. Now if we put your plugin as a plugin, then we can call the goal that will perform our task: mvn xray:import-results

Actually the examples you have are working like this one, the readme file just differs for some reason from the examples: https://github.com/Xray-App/xray-maven-plugin/blob/main/examples/cloud/pom.xml.sample

bitcoder commented 1 year ago

Thanks @terencenmnpan , will fix that

bitcoder commented 1 year ago

fixed