Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

java.lang.NoClassDefFoundError: org/sonatype/aether/artifact/Artifact #135

Open
ShahinKordasti opened this issue Oct 2, 2014 · 7 comments

Comments

@ShahinKordasti
Copy link

I tried using this plugin to create a war of our soap ui xml file and when I run it I get:

[WARNING] Error injecting: org.ktc.soapui.maven.extension.MockAsWarMojo
java.lang.NoClassDefFoundError: org/sonatype/aether/artifact/Artifact
...
[ERROR] Failed to execute goal com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:4.6.4.1:mock-as-war (uis-stub-war) on project xxx-uis-stub: Execution uis-stub-war of goal com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:4.6.4.1:mock-as-war failed: A required class was missing while executing com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:4.6.4.1:mock-as-war: org/sonatype/aether/artifact/Artifact

I tried adding a bunch of dependencies, including sonatype aether but it did not fix it. My pom.xml looks like this:

<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <repositories>
        <repository>
            <id>soapuiRepository</id>
            <url>http://www.soapui.org/repository/maven2</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>soapuiPluginRepository</id>
            <url>http://www.soapui.org/repository/maven2/</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <groupId>com.github.redfish4ktc.soapui</groupId>
                <artifactId>maven-soapui-extension-plugin</artifactId>
                <version>4.6.4.1</version>
                <executions>
                    <execution>
                        <id>uis-stub-war</id>
                        <phase>package</phase>
                        <configuration>
                            <projectFile>${project.basedir}/src/test/resources/Digital-Mock-Services-soapui-project.xml</projectFile>
                            <warFile>${project.build.directory}/soapui/uis-stub.war</warFile>
                        </configuration>
                        <goals>
                            <goal>mock-as-war</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.sonar</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>4.5-RC3</version>
                    </dependency>
                    <dependency>
                        <groupId>org.sonatype.aether</groupId>
                        <artifactId>aether-api</artifactId>
                        <version>1.13.1</version>
                    </dependency>
                    <dependency>
                        <groupId>org.sonatype.aether</groupId>
                        <artifactId>aether-util</artifactId>
                        <version>1.13.1</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

I am using maven 3.2.3

@ShahinKordasti
Copy link
Author

Not sure if this is related to this issue: https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound

@redfish4ktc
Copy link
Owner

Hi @shakor I suspect you have the same issue than what is discribed in #120 and yes, this is something related to AetherClassNotFound.
The mock-as-war goal currently only supports maven 3.0.x (see #70 and #121). This is a limitiation which is documented

Tell me if something is not clear in the doc, I can uprove it.

@ShahinKordasti
Copy link
Author

Hello, thanks for the info. I downgraded to maven 3.0.5 and now it works. I did not see in the Git Hub read me that only maven 3.0.x is supported and not higher versions, maybe that should be more clear there.

Also I kind of lacked a complete example. I now there are some under the git hub IT folder but it has so much stuff in there so I was not sure if I needed all of that or not. A simple, complete example would be very useful. For example, I still dont know how to add your own web.xml (if you even can) to the produced war or how to have it installed by maven in the repository as mvn clean install does not seem to do it by itself.

@redfish4ktc
Copy link
Owner

Ok thanks for the feedback,
The limitation is described in the Goals page, but maybe this is not enough
About providing examples, the readme has a link to the mock-as-war dedicated page where you already have examples.

About

  • "add your own web.xml", this is currently not possible (as this is not possible in SoapUI), if you need such a feature, create a dedicated issue
  • "how to have it installed by maven in the repository as mvn clean install does not seem to do it by itself", I will add an example

@ShahinKordasti
Copy link
Author

Thanks, would very much appreciate an example for how to get it installed. Because if I set the package type of the maven module to war then it complains about not having a web.xml. If I remove the package type, it only installs the jar and not the war being produced by the plugin :/

I know you can specifically install an artifact by adding paramters to the maven command but as this module is being built as part of an aggregated maven project I would like that a simple 'mvn install' installs the war.

@ShahinKordasti
Copy link
Author

If anyone is interested I solved the war installation by adding the following to my pom:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-war</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <packaging>war</packaging>
                            <artifactId>${project.artifactId}</artifactId>
                            <groupId>${project.groupId}</groupId>
                            <version>${project.version}</version>
                            <file>${project.build.directory}/${project.build.finalName}.war</file>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

@redfish4ktc
Copy link
Owner

Hi,
I have added a new example. Instead of installing the file, I attach the war as project artifact.

I have also updated the mock-as-war dedicated page: it now has a warning about maven 3.0.x only support.

Tell me if it is clear for you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants