Hello I'm trying to use Maxwell's Equations to calculate the electromagnetic fields around different charge/current situations like from a charge using $\nabla \cdot E = \frac{\rho}{\epsilon_0}$ to obtain Coulomb's Law. One area I'm getting stuck on however is the magnetic field around a current-carrying wire of finite length. I know how to do this with the Biot–Savart law for wires of many shapes, but I can't seem to figure it out starting from just the Ampere-Maxwell equation: $\nabla\times B=\mu_0(J+\epsilon_0\frac{\partial E}{\partial t})$. I'm not sure how I can incorporate wire length into these equations and I keep getting the equation for a wire of infinite length.
Here's my general process:
There is a straight wire with length $l$ and radius $r$ carrying a current $I$. We want to find the strength of the magnetic field $B$ at a distance of $x$ from the center of the wire. The point is aligned vertically with the line so that the distance between the point and either ends of the wire are equal.
We start off with the Ampere-Maxwell equation:
$$\nabla\times B=\mu_0(J+\epsilon_0\frac{\partial E}{\partial t})$$
We can drop $\epsilon_0\frac{\partial E}{\partial t}$ since the electric field does not change.
$$\nabla\times B=\mu_0 J$$
The current density $J$ is expanded to $\frac{I}{\pi r^2}$:
$$\nabla\times B=\frac{\mu_0 I}{\pi r^2}$$
To find $B$ we can use Stokes' Theorem, showing that the magnetic field along the circumference $L_1$ of a circle $A_1$ is found by integrating the magnetic curl within that circle (assuming symmetry):
$$\int_{L_1} B_1 \cdot dL_1 = \iint_{A_1} \nabla \times B \cdot dA_1$$
In the above diagram, the circle has the radius $r$ and is positioned in the center of the wire, so solving for $B_1$ should give us the magnetic field at the surface of wire. To find it at a distance of $x$, we use the fact that there is no current outside the wire. In other words, the curl within in the wire is $>0$ and anywhere outside of it is $=0$. Therefore, for any radius $>r$ of the circle, the integral within it will be constant and equal to that of circle $A_1$.
So if we have a second circle $A_2$ with radius $x$:
$$\int_{L_1} B_1 \cdot dL_1 = \iint_{A_1} \nabla \times B \cdot dA_1 = \iint_{A_2} \nabla \times B \cdot dA_2 = \int_{L_2} B \cdot dL_2$$
$$\iint_{A_1} \nabla \times B \cdot dA_1 = \int_{L_2} B \cdot dL_2$$
Assuming perfect symmetry, $B$ and $\nabla \times B$ are constant within the integral so can be pulled out:
$$\nabla \times B\iint_{A_1} dA_1 = B\int_{L_2} dL_2$$
Solving for $B$
$$\frac{\mu_0 I}{\pi r^2} \cdot \pi r^2 = B \cdot 2 \pi x$$
$$\mu_0 I = B \cdot 2 \pi x$$
$$B = \frac{\mu_0 I}{2 \pi x}$$
However, this is the equation for the magnetic field around a wire of infinite length. I'm trying to find one for length $l$. I'm at a complete loss as to where in the previous steps I would use $l$. Also why is an infinite wire the result of these steps, nowhere did I specify the length of wire.
What I'm asking is, starting from the last Maxwell equation, how would I calculate the magnetic field around a wire of finite length? What am I doing wrong? Any help/insight would be appreciated.