package does not exist (Maven)

Asked

Viewed 854 times

1

Let’s contextualize the problem:

I have a project that consumes some Web Services, in this project I have separate source folders as suggested by Maven ex:(main/java test/java), the classes generated based on the WSDL of Web Services ended up separating in main/wsdl so that it was possible to deleteThe coverage of tests (Eclemma), was the only way I found to do this.

When I run the Maven install command via Eclipse everything works fine, but when executing the same command via the command line it throws an exception saying that the packages that make up my generated classes do not exist (if lost).

Someone’s been there and they know how to fix it?

  • Hard to say, but it looks like you have the Eclipse project set up to generate the classes while the Maven project doesn’t. It’s that moment when you discover that the wonderful IDE that does everything for you gets in the way when you try to do things without it.

  • If you want a more specific answer, please edit your question and add details about class generation and your project configuration.

  • @utluiz do not know what details I could add to make it clearer, which part you did not understand?

  • Could post, for example, the excerpt from pom.xml where is configured the generation of classes from the WSDL and also the stretch where you include this directory in the build. Understand that Maven does not perform the same for Eclipse and per command line. In Eclipse, it depends on a paid plugin working, which is usually M2E (Maven to Eclipse). This plugin makes some "magic" bespoke in the Eclipse settings that are in the '.project' file, which helps in using the IDE, but leaves you hanging without it.

  • It’s not that I didn’t understand your problem, only that you can’t guess the cause without knowing how the project is configured.

  • I’ll try to clarify, my packages are separated into: src/main/java (classes created by me), src/main/Resources (.properties and etc...) src/main/wsdl (class generated from web service that uses another application) src/test/java (unit tests), when I give the install by the eclipse everything goes well, via line

  • I understood perfectly what you said you did, but if you don’t show as has done no good. I have no way to guess. How will I know that the done setting is correct? All I have is your word that should be in such and such a way. But if you think your setup is correct, then I am not the one who will say that there is something missing or incorrect.

  • @utluiz I ended up solving my problem as follows, I moved my source from src/main/wsdl to src/main/java/wsdl, I did a little research and found that the default Maven searches for the src/main/java fonts, whatever is outside of it it ignores, I did not find a way to set up for him to find in src/main/wsdl, but as it solved my problem for now I stopped researching, anyway I appreciate your contribution :)

Show 3 more comments

2 answers

1


I added the following settings to my pom.xml.

 <project>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/wsdl</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

0

The way I solved my problem was to move my source to:

src/main/wsdl

for:

src/main/java/wsdl

for some reason Maven searches by default the sources in (src/main/java), whatever is outside of this he ends up ignoring, I did not find a way to configure so that he considers what is outside of this pattern.

  • The reason he looks in this folder is because this is exactly how it was designed, but it is possible to add other directories by adding some little things figurations to your POM. See, for example: http://blog.sonatype.com/2008/05/adding-additional-source-folders-to-your-maven-build/#. Vmn_kcs7bqa

  • 1

    @utluiz I tried to make these settings but I did not succeed, I must have done something wrong, I will try again and put here if I can

  • 1

    @utluiz worked :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.