Java – Maven eclipse does not add dependencies

My POM The following code snippet is in the XML (you can execute the complete POM below)

<dependency>
    <groupId>aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>1.5.3</version>
</dependency>

In one of my java files, I referenced a class org aspectj. lang.ProceedingJoinPoint. When I do a "clean MVN installation", it compiles and builds well, but when I do an eclipse: Eclipse and import the project in eclipse, it gives me an error to import org AspectJ cannot be resolved I checked the generated Classpath file, which has no entries for this file I tried a "MVN dependency: tree", which lists this fine

I don't have any fancy settings to compile any java files It's just an incredible routine of garbage

Can someone tell me what's wrong here?

Update 1: I am using the Maven eclipse plug-in version: 2.7

Update 2: just use the following POM and make an MVN Eclipse: clean Eclipse: eclipse from the command line

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ekanathk</groupId>
    <artifactId>stackoverflow</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.5.3</version>
        </dependency>
        <dependency>
            <groupId>aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.5.3</version>
        </dependency>
    </dependencies>
</project>

Solution

I'm just trying to recreate the problem. I can't This is obtained after adding AspectJ classpath:aspectjrt:jar:1.5. 3 dependency is related to a newly created project:

<classpath>
  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
  <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="var" path="M2_REPO/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar">
    <attributes>
      <attribute value="jar:file:/home/pascal/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3-javadoc.jar!/" name="javadoc_location"/>
    </attributes>
  </classpathentry>
  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>

What version of Maven Eclipse Plug-in do you use? Do you configure it to use ajdt? Can you display your configuration?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>